/* BIM Model Generation Dashboard Styles */

:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --accent-primary: #0ea5e9;
    --accent-secondary: #3b82f6;
    --success: #22c55e;
    --warning: #fb923c;
    --error: #ef4444;
    --border: #334155;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
}

/* ========== LOGIN SCREEN ========== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    padding: 2rem;
}

.login-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 3rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header svg {
    color: var(--accent-primary);
    margin-bottom: 1rem;
}

.login-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.error-message {
    color: var(--error);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    display: none;
}

.error-message.show {
    display: block;
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.4);
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== DASHBOARD ========== */
.dashboard {
    min-height: 100vh;
    background: var(--bg-dark);
}

.dashboard-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-left svg {
    color: var(--accent-primary);
}

.header-left h1 {
    font-size: 1.5rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.15);
    color: var(--accent-primary);
    text-transform: uppercase;
}

/* ========== STATS CARDS ========== */
.stats-strip {
    display: flex;
    gap: 8px;
    padding: 12px 2rem;
    flex-wrap: wrap;
    align-items: center;
}

.stat-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 14px;
    cursor: default;
}

.stat-pill-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-pill-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-pill.stat-pending { border-color: rgba(14,165,233,0.3); }
.stat-pill.stat-pending .stat-pill-value { color: #0ea5e9; }

.stat-pill.stat-inprogress { border-color: rgba(59,130,246,0.3); }
.stat-pill.stat-inprogress .stat-pill-value { color: #3b82f6; }

.stat-pill.stat-done { border-color: rgba(34,197,94,0.3); }
.stat-pill.stat-done .stat-pill-value { color: #22c55e; }

.stat-pill.stat-mydone { border-color: rgba(168,85,247,0.3); }
.stat-pill.stat-mydone .stat-pill-value { color: #a855f7; }

.stat-pill.stat-flagged { border-color: rgba(251,146,60,0.3); }
.stat-pill.stat-flagged .stat-pill-value { color: #fb923c; }

/* Role badges */
.role-badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.role-badge.role-admin { background: rgba(239,68,68,0.15); color: #ef4444; }
.role-badge.role-high { background: rgba(168,85,247,0.15); color: #a855f7; }
.role-badge.role-standard { background: rgba(59,130,246,0.15); color: #3b82f6; }

/* Admin table */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { text-align: left; padding: 8px 12px; font-size: 12px; color: var(--text-secondary); text-transform: uppercase; border-bottom: 1px solid var(--border); }
.admin-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-primary); }
.admin-table tr:hover td { background: rgba(255,255,255,0.02); }
.admin-table select, .admin-table input { padding: 4px 8px; background: var(--bg-main); border: 1px solid var(--border); border-radius: 4px; color: var(--text-primary); font-size: 12px; }
.admin-table .btn-sm { padding: 4px 10px; font-size: 11px; border-radius: 4px; cursor: pointer; border: none; }
.admin-table .btn-assign { background: rgba(59,130,246,0.15); color: #3b82f6; }
.admin-table .btn-toggle { background: rgba(251,146,60,0.15); color: #fb923c; }

/* ========== SEARCH & FILTER BAR ========== */
.search-filter-bar {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.625rem 1rem;
    transition: border-color 0.2s;
}

.search-box:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.search-box svg {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.search-box input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-chip {
    padding: 0.375rem 0.875rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.filter-chip:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.filter-chip.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.filter-results-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ========== TASKS LIST ========== */
.tasks-container {
    padding: 0 2rem 2rem;
}

.tasks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.tasks-header h2 {
    font-size: 1.5rem;
}

.tasks-list {
    display: grid;
    gap: 1rem;
}

.task-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.task-card:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 4px 16px rgba(14, 165, 233, 0.15);
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.task-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.task-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.task-status {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
    text-transform: uppercase;
}

.task-status.pending {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}

.task-status.assigned {
    background: rgba(14, 165, 233, 0.15);
    color: var(--accent-primary);
}

.task-status.in_progress {
    background: rgba(251, 146, 60, 0.15);
    color: var(--warning);
}

.task-status.completed {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.task-status.partial {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.task-status.flagged {
    background: rgba(251, 146, 60, 0.15);
    color: var(--warning);
}

.completed-card {
    border-color: rgba(34, 197, 94, 0.3);
}

.partial-card {
    border-color: rgba(59, 130, 246, 0.3);
}

.flagged-card {
    border-color: rgba(251, 146, 60, 0.3);
}

.btn-flag {
    color: var(--warning) !important;
    border-color: rgba(251, 146, 60, 0.3) !important;
}

.btn-flag:hover {
    background: rgba(251, 146, 60, 0.1) !important;
}

.task-body {
    display: grid;
    gap: 1rem;
}

.task-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.task-info svg {
    color: var(--accent-primary);
}

.task-pdfs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.pdf-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pdf-item:hover {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

.pdf-item svg {
    color: #ef4444;
}

.task-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.btn-upload {
    flex: 1;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.btn-upload:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.btn-start {
    background: var(--warning);
    color: white;
}

/* ========== EMPTY STATE ========== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state svg {
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.125rem;
}

/* ========== FILE INPUT ========== */
.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.file-input-wrapper input[type=file] {
    position: absolute;
    left: -9999px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .stats-strip {
        justify-content: center;
    }

    .task-actions {
        flex-direction: column;
    }
}

/* Overlay and annotation panel */
.pdf-page-wrapper {
    position: relative;
}

.pdf-page-wrapper .pdf-overlay {
    position: absolute;
    inset: 0;
    pointer-events: auto;
    background: transparent;
}

#pdf-content-area {
    position: relative;
}

#anno-panel-toggle {
    position: absolute;
    right: 368px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 60px;
    background: #0b1222;
    border: 1px solid #1f2937;
    border-right: none;
    border-radius: 8px 0 0 8px;
    color: #94a3b8;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1101;
    padding: 0;
    transition: right 0.3s ease, color 0.2s;
}

#anno-panel-toggle:hover {
    color: #e2e8f0;
    background: #1e293b;
}

#anno-panel-toggle.panel-collapsed {
    right: 0;
}

#pdf-annotation-panel {
    position: absolute;
    top: 100px;
    right: 20px;
    bottom: 20px;
    width: 340px;
    background: #0b1222;
    border: 1px solid #1f2937;
    border-radius: 10px;
    padding: 14px;
    color: #e2e8f0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 1100;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.3s ease;
}

#pdf-annotation-panel.collapsed {
    transform: translateX(380px);
}

#pdf-annotation-panel h4 {
    margin: -14px -14px 10px -14px;
    padding: 14px 14px 10px 14px;
    font-size: 16px;
    font-weight: 700;
    position: sticky;
    top: -14px;
    background: #0b1222;
    z-index: 1;
    border-bottom: 1px solid #1f2937;
}

.anno-group {
    margin-bottom: 12px;
    border-top: 1px solid #1f2937;
    padding-top: 10px;
}

.anno-group:first-of-type {
    border-top: none;
    padding-top: 0;
}

.anno-label {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.anno-row {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
}

#pdf-annotation-panel button {
    padding: 8px 10px;
    background: #1f2937;
    color: #e2e8f0;
    border: 1px solid #1f2937;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    flex: 1;
    transition: background 0.2s, border-color 0.2s;
}

#pdf-annotation-panel button:hover {
    background: #2d3748;
}

#pdf-annotation-panel button.primary {
    background: #0ea5e9;
    border-color: #0284c7;
    color: #0b1222;
}

#pdf-annotation-panel button.secondary {
    background: #111827;
}

#pdf-annotation-panel button.full {
    width: 100%;
}

#pdf-annotation-panel input[type="number"] {
    width: 100%;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #1f2937;
    background: #0f172a;
    color: #e2e8f0;
}

.anno-radio {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    margin-bottom: 4px;
}

/* Tower Tabs */
#tower-tabs-container {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    padding: 0 4px;
}

.tower-tab-btn {
    padding: 6px 14px !important;
    font-size: 12px !important;
    border-radius: 6px;
    cursor: pointer;
    flex: 1 !important;
    min-width: 0 !important;
    background: #111827 !important;
    border: 1px solid #1f2937 !important;
    color: #94a3b8 !important;
    transition: all 0.2s;
    text-align: center;
}

.tower-tab-btn:hover {
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

.tower-tab-btn.active {
    background: rgba(251, 146, 60, 0.12) !important;
    border-color: #fb923c !important;
    color: #fb923c !important;
    font-weight: 600;
}

/* Tower Type Card Selector */
.tower-type-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 6px;
}

.tower-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #111827;
    border: 2px solid #1f2937;
    border-radius: 8px;
    padding: 8px 4px 6px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    text-align: center;
    user-select: none;
}

.tower-type-card img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    margin-bottom: 5px;
    border-radius: 4px;
    pointer-events: none;
}

.tower-type-card span {
    font-size: 9.5px;
    color: #94a3b8;
    line-height: 1.25;
    pointer-events: none;
}

.tower-type-card:hover {
    border-color: #334155;
    background: #1e293b;
}

.tower-type-card.active {
    border-color: #fb923c;
    background: rgba(251, 146, 60, 0.08);
    box-shadow: 0 0 10px rgba(251, 146, 60, 0.2);
}

.tower-type-card.active span {
    color: #fb923c;
    font-weight: 600;
}

/* Lattice Radio Card (toggle buttons) */
.lattice-radio-card {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: 1px solid #1f2937;
    border-radius: 6px;
    background: #0f172a;
    cursor: pointer;
    transition: all 0.15s;
    flex: 1;
}
.lattice-radio-card span {
    font-size: 12px;
    color: #94a3b8;
    text-align: center;
}
.lattice-radio-card:hover {
    border-color: #334155;
    background: #1e293b;
}
.lattice-radio-card.active {
    border-color: #fb923c;
    background: rgba(251, 146, 60, 0.08);
}
.lattice-radio-card.active span {
    color: #fb923c;
    font-weight: 600;
}

/* Building Level Panels */
.building-level-panel {
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
}

.building-level-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.building-level-title {
    font-size: 13px;
    font-weight: 600;
    color: #0ea5e9;
}

.building-level-remove {
    background: none !important;
    border: none !important;
    color: #ef4444 !important;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px !important;
    flex: none !important;
    line-height: 1;
}

.building-level-remove:hover {
    color: #dc2626 !important;
}

.anno-sub-group {
    margin-bottom: 8px;
}

.anno-sub-group:last-child {
    margin-bottom: 0;
}

.anno-add-level-row {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.anno-add-level-btn {
    background: transparent !important;
    border: 1px dashed #334155 !important;
    color: #94a3b8 !important;
    padding: 6px 16px !important;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    width: 100%;
    transition: border-color 0.2s, color 0.2s;
}

.anno-add-level-btn:hover {
    border-color: #0ea5e9 !important;
    color: #0ea5e9 !important;
}

#pdf-annotation-panel::-webkit-scrollbar {
    width: 6px;
}

#pdf-annotation-panel::-webkit-scrollbar-track {
    background: #0b1222;
}

#pdf-annotation-panel::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}

#pdf-annotation-panel::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Tower Configuration Sections */
.tower-config-section {
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
}

.tower-config-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #fb923c;
    margin-bottom: 8px;
}

.tower-config-row {
    margin-bottom: 6px;
}

#pdf-annotation-panel .tower-config-section label,
#pdf-annotation-panel .section-row-inline label,
#pdf-annotation-panel .section-entry label,
#pdf-annotation-panel .rifu-entry label {
    font-size: 11px;
    color: #94a3b8;
    display: block;
    margin-bottom: 3px;
}

#pdf-annotation-panel select {
    width: 100%;
    padding: 7px 8px;
    border-radius: 6px;
    border: 1px solid #1f2937;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 12px;
    appearance: auto;
}

#pdf-annotation-panel input[type="number"].tower-config-input {
    width: 100%;
    padding: 7px 8px;
    border-radius: 6px;
    border: 1px solid #1f2937;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 12px;
}

.section-row-inline {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

.section-row-inline > div {
    flex: 1;
}

.section-entry {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 6px;
}

.section-entry-title {
    font-size: 11px;
    color: #64748b;
    margin-bottom: 4px;
}

.rifu-entry {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 6px;
}

.anno-add-item-btn {
    background: transparent !important;
    border: 1px dashed #334155 !important;
    color: #94a3b8 !important;
    padding: 4px 10px !important;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    width: 100%;
    margin-top: 4px;
}

.anno-add-item-btn:hover {
    border-color: #fb923c !important;
    color: #fb923c !important;
}
