/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Sidebar navigation items */
.nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    cursor: pointer;
    color: #c4cdd8;
    font-size: 13px;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: #354050;
    color: #fff;
}

.nav-item.active {
    background: rgba(26, 139, 209, 0.12);
    color: #fff;
    border-left-color: #1a8bd1;
}

.nav-item-name {
    font-size: 13px;
    line-height: 1.3;
}

.nav-item-meta {
    display: flex;
    gap: 2px;
    font-size: 10px;
    color: #6b7a8a;
    margin-top: 2px;
}

.nav-item.active .nav-item-meta {
    color: #7ec8f0;
}

/* View toggle (Projects / Employees) */
.view-toggle {
    flex: 1;
    padding: 5px 0;
    font-size: 12px;
    font-weight: 600;
    color: #8f9bab;
    background: transparent;
    border: 1px solid #4a5568;
    cursor: pointer;
    transition: all 0.15s;
}

.view-toggle:first-child { border-radius: 6px 0 0 6px; }
.view-toggle:last-child { border-radius: 0 6px 6px 0; border-left: none; }

.view-toggle.active {
    color: #fff;
    background: #1a8bd1;
    border-color: #1a8bd1;
}

.view-toggle:not(.active):hover {
    color: #fff;
    border-color: #718096;
}

/* Sort buttons */
.sort-btn {
    padding: 3px 8px;
    font-size: 10px;
    color: #8f9bab;
    background: transparent;
    border: 1px solid #4a5568;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.sort-btn:hover {
    color: #fff;
    border-color: #718096;
}

.sort-btn.active {
    color: #fff;
    background: #1a8bd1;
    border-color: #1a8bd1;
}

/* Sort buttons on light background (modals, content area) */
.modal-summary .sort-btn {
    color: #6b7280;
    border-color: #d1d5db;
}

.modal-summary .sort-btn:hover {
    color: #374151;
    border-color: #9ca3af;
}

.modal-summary .sort-btn.active {
    color: #fff;
    background: #1a8bd1;
    border-color: #1a8bd1;
}

/* Stat cards */
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e5e7eb;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.stat-card.blue::before { background: #1a8bd1; }
.stat-card.green::before { background: #27ae60; }
.stat-card.yellow::before { background: #f5a623; }
.stat-card.red::before { background: #e74c3c; }

.stat-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.1;
}

.stat-label {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Tabs */
.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    font-size: 14px;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    transition: color 0.15s, border-color 0.15s;
}

.tab-btn:hover {
    color: #374151;
}

.tab-btn.active {
    color: #1a8bd1;
    border-bottom-color: #1a8bd1;
}

.tab-count {
    background: #e5e7eb;
    color: #6b7280;
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 10px;
}

.tab-btn.active .tab-count {
    background: #dbeafe;
    color: #1a8bd1;
}

/* Task table */
.task-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.task-table thead th {
    position: sticky;
    top: 0;
    background: #f9fafb;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.sortable-th {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
}

.sortable-th:hover {
    color: #1a8bd1;
}

.task-table tbody tr {
    transition: background 0.1s;
}

.task-table tbody tr:hover {
    background: #f9fafb;
}

.task-table tbody td {
    padding: 10px 12px;
    font-size: 13px;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.task-table .task-link {
    color: #1a8bd1;
    text-decoration: none;
    font-weight: 500;
}

.task-table .task-link:hover {
    text-decoration: underline;
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.status-new { background: #eff6ff; color: #2563eb; }
.status-pending { background: #fef3c7; color: #b45309; }
.status-progress { background: #ecfdf5; color: #059669; }
.status-closed { background: #f3f4f6; color: #6b7280; }
.status-deferred { background: #fef2f2; color: #dc2626; }

/* Priority */
.priority-high {
    color: #dc2626;
    font-weight: 600;
}

.priority-low {
    color: #9ca3af;
}

/* Employee cards */
.employee-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    transition: box-shadow 0.15s;
}

.employee-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.avatar-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 15px;
    color: white;
    flex-shrink: 0;
}

.mini-stat {
    text-align: center;
    padding: 6px 0;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s;
}

.mini-stat:hover {
    background: #f3f4f6;
}

.mini-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: #1a8bd1;
}

.mini-stat-label {
    font-size: 10px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.time-stat {
    cursor: pointer;
    border-radius: 6px;
    padding: 2px 8px;
    transition: background 0.15s;
    display: inline-block;
}

.time-stat:hover {
    background: #f3f4f6;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

#sidebar ::-webkit-scrollbar-thumb {
    background: #4a5568;
}

/* B24 open link in frame */
.b24-link {
    color: #1a8bd1;
    cursor: pointer;
}

.b24-link:hover {
    text-decoration: underline;
}

/* Duration text */
.duration-text {
    font-size: 12px;
    color: #6b7280;
}

.duration-overdue {
    color: #dc2626;
    font-weight: 500;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-overlay.hidden {
    display: none;
}

.modal-container {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 750px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.modal-body {
    overflow-y: auto;
    padding: 0;
    flex: 1;
}

.modal-task-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
    transition: background 0.1s;
}

.modal-task-row:last-child {
    border-bottom: none;
}

.modal-task-row:hover {
    background: #f9fafb;
}

.modal-task-title {
    flex: 1;
    min-width: 0;
}

.modal-task-title a {
    color: #1a8bd1;
    text-decoration: none;
    font-weight: 500;
}

.modal-task-title a:hover {
    text-decoration: underline;
}

.modal-task-meta {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #6b7280;
}

.modal-summary {
    padding: 16px 24px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-size: 13px;
    color: #6b7280;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* Employee project rows */
.emp-project-row {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 8px;
    transition: box-shadow 0.15s;
}

.emp-project-row:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Date preset buttons */
.date-preset-btn {
    flex: 1;
    padding: 3px 4px;
    font-size: 10px;
    color: #8f9bab;
    background: transparent;
    border: 1px solid #4a5568;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    text-align: center;
}

.date-preset-btn:hover {
    color: #fff;
    border-color: #718096;
}

.date-preset-btn.active {
    color: #fff;
    background: #1a8bd1;
    border-color: #1a8bd1;
}

/* Date range row */
.date-range-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
}

.date-range-row.hidden {
    display: none;
}

.date-input {
    flex: 1;
    padding: 3px 6px;
    font-size: 11px;
    color: #fff;
    background: #354050;
    border: 1px solid #4a5568;
    border-radius: 6px;
    outline: none;
    min-width: 0;
}

.date-input:focus {
    border-color: #1a8bd1;
}

.date-input::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
    cursor: pointer;
}

.date-apply-btn {
    padding: 3px 8px;
    font-size: 10px;
    color: #fff;
    background: #1a8bd1;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}

.date-apply-btn:hover {
    background: #1579b5;
}

/* Filter status */
.filter-status {
    margin-top: 6px;
    font-size: 11px;
    color: #8f9bab;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-status.hidden {
    display: none;
}

.filter-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid #4a5568;
    border-top-color: #1a8bd1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

/* Rate input */
.rate-input::-webkit-outer-spin-button,
.rate-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.rate-input {
    -moz-appearance: textfield;
}

/* ===== Mobile Landscape (rotated phone) ===== */
@media (max-height: 500px) {
    /* Sidebar: narrower */
    #sidebar {
        width: 180px;
    }

    #sidebar .px-4 { padding-left: 10px; padding-right: 10px; }
    #sidebar .px-3 { padding-left: 8px; padding-right: 8px; }
    #sidebar .py-3 { padding-top: 6px; padding-bottom: 6px; }
    #sidebar .py-2 { padding-top: 4px; padding-bottom: 4px; }

    #sidebar h1 {
        font-size: 13px;
    }

    #sidebar-search {
        padding: 4px 8px;
        font-size: 11px;
    }

    /* Nav items: compact */
    .nav-item {
        padding: 5px 10px;
        font-size: 12px;
    }

    .nav-item-name {
        font-size: 12px;
    }

    .nav-item-meta {
        font-size: 9px;
    }

    /* View toggle / date presets */
    .view-toggle {
        padding: 3px 0;
        font-size: 11px;
    }

    .date-preset-btn {
        padding: 2px 3px;
        font-size: 9px;
    }

    #sidebar-stats {
        padding: 6px 10px;
        font-size: 10px;
    }

    /* Stat cards: compact */
    .stat-card {
        padding: 10px;
        border-radius: 8px;
    }

    .stat-value {
        font-size: 22px;
    }

    .stat-label {
        font-size: 10px;
        margin-top: 2px;
    }

    /* Project header: compact */
    #project-detail > .bg-white.border-b,
    #employee-detail > .bg-white.border-b {
        padding: 8px 16px;
    }

    #project-title, #emp-title {
        font-size: 16px;
    }

    #project-subtitle, #emp-subtitle {
        font-size: 12px;
    }

    #project-link, #emp-link {
        padding: 4px 10px;
        font-size: 12px;
    }

    /* Tabs */
    .tab-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    /* Task table: compact */
    .task-table thead th {
        padding: 6px 8px;
        font-size: 10px;
    }

    .task-table tbody td {
        padding: 6px 8px;
        font-size: 12px;
    }

    /* Employee cards */
    .employee-card {
        padding: 10px;
        border-radius: 8px;
    }

    .avatar, .avatar-placeholder {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .mini-stat-value {
        font-size: 14px;
    }

    .mini-stat-label {
        font-size: 9px;
    }

    /* Modals: fullscreen */
    .modal-overlay {
        padding: 0;
    }

    .modal-container {
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
        height: 100%;
    }

    .modal-header {
        padding: 12px 16px;
    }

    .modal-task-row {
        padding: 6px 16px;
        font-size: 12px;
    }

    .modal-summary {
        padding: 10px 16px;
        font-size: 12px;
    }

    /* CTA banner: compact */
    #demo-cta {
        padding: 6px 16px !important;
    }

    #demo-cta span {
        font-size: 12px !important;
    }

    #demo-cta a {
        font-size: 11px !important;
        padding: 4px 14px !important;
        margin-left: 10px !important;
    }

    /* Content area padding */
    .tab-content.px-6 {
        padding-left: 16px;
        padding-right: 16px;
    }

    .tab-content.py-4 {
        padding-top: 8px;
        padding-bottom: 8px;
    }

    /* Stats grid */
    #project-stats {
        gap: 8px;
    }

    #emp-stats {
        gap: 8px;
    }

    /* Sort buttons in sidebar */
    .sort-btn {
        padding: 2px 6px;
        font-size: 9px;
    }
}
