/* Madaba Advocates Admin Panel Styles */

/* Modal - default hidden */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 8px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-500);
}

.modal-close:hover {
    color: var(--gray-700);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 20px;
}

.tab {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--gray-500);
    font-weight: 500;
    transition: all 0.2s;
}

.tab:hover {
    color: var(--gray-700);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Search */
.search-box {
    position: relative;
    max-width: 300px;
}

.search-box input {
    padding-left: 40px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}

/* Filters */
.filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 0.85rem;
    color: var(--gray-600);
}

/* Text utilities */
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-success { color: var(--success); }
.text-primary { color: var(--primary); }
.text-muted { color: var(--gray-500); }
.fw-semibold { font-weight: 600; }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
}

.pagination a,
.pagination span {
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.pagination a {
    background: var(--gray-100);
    color: var(--gray-700);
    text-decoration: none;
}

.pagination a:hover {
    background: var(--gray-200);
}

.pagination span {
    background: var(--primary);
    color: white;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Tooltips */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: var(--gray-800);
    color: white;
    font-size: 0.75rem;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Progress */
.progress {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
}

/* Activity Feed */
.activity-feed {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--gray-100);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 500;
    color: var(--gray-800);
}

.activity-description {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 2px;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--gray-400);
}

/* Quick Stats Row */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.quick-stat {
    background: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.quick-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.quick-stat-label {
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* Empty Table State */
.table-empty {
    text-align: center;
    padding: 40px;
    color: var(--gray-500);
}

.table-empty i {
    font-size: 2.5rem;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Form Row */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

/* Status Indicators */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-active { background: var(--success); }
.status-inactive { background: var(--gray-400); }
.status-pending { background: var(--warning); }

/* Dropdown */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    min-width: 150px;
    z-index: 100;
    display: none;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 10px 15px;
    color: var(--gray-700);
    text-decoration: none;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: var(--gray-100);
}

.dropdown-item:first-child {
    border-radius: 6px 6px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 6px 6px;
}

/* Date/Time */
.datetime {
    font-size: 0.85rem;
    color: var(--gray-500);
}

/* Responsive utilities */
@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        max-width: 100%;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Folder tree write-only highlighting */
.folder-item.write-only .folder-name {
    opacity: 0.85;
}
.folder-item.write-only:hover {
    background: rgba(220, 38, 38, 0.04);
}

/* ========== Documents Module Mobile Responsiveness ========== */

/* Collapse low-priority table columns on tablet/mobile */
@media (max-width: 768px) {
    #docsTable th:nth-child(3),
    #docsTable td:nth-child(3),
    #docsTable th:nth-child(5),
    #docsTable td:nth-child(5),
    #docsTable th:nth-child(6),
    #docsTable td:nth-child(6),
    #docsTable th:nth-child(8),
    #docsTable td:nth-child(8) {
        display: none;
    }

    /* Larger action button touch targets */
    #docsTable .actions .btn,
    #docsTable .actions form .btn {
        min-width: 36px;
        min-height: 36px;
        padding: 6px 10px !important;
        font-size: 0.85rem !important;
    }

    /* Grid view cards — always show actions on touch devices */
    .file-card .card-checkbox {
        display: block !important;
    }
    .file-card .card-actions {
        display: flex !important;
    }

    /* Bulk toolbar — fixed bottom bar */
    .bulk-actions {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 999;
        margin-bottom: 0 !important;
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
        border-bottom: none !important;
        box-shadow: 0 -2px 12px rgba(0,0,0,0.1);
        padding: 12px 16px !important;
        flex-wrap: wrap;
        gap: 6px !important;
    }
    .bulk-actions .btn {
        min-height: 36px;
        font-size: 0.8rem;
    }
    .bulk-actions span:first-child {
        width: 100%;
        margin-bottom: 2px;
    }

    /* Folder sidebar on mobile — collapsible */
    .folder-sidebar .card-header {
        cursor: pointer;
        user-select: none;
    }
    .folder-sidebar .card-header .card-title {
        flex: 1;
    }
    .folder-sidebar .card-header::after {
        content: '\f078';
        font-family: 'Font Awesome 5 Free';
        font-weight: 900;
        font-size: 0.75rem;
        color: var(--gray-400);
        transition: transform 0.2s;
    }
    .folder-sidebar.collapsed .card-body,
    .folder-sidebar.collapsed .card-footer {
        display: none;
    }
    .folder-sidebar.collapsed .card-header::after {
        transform: rotate(180deg);
    }

    /* Header actions — collapse secondary buttons */
    .header-actions-secondary {
        display: none;
    }
    .header-actions-secondary.show {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        margin-top: 8px;
    }
    /* Filter/search bar — stack on mobile */
    #docSearch {
        min-width: 0;
    }
    .header-actions-toggle {
        display: inline-flex !important;
    }
}

@media (max-width: 480px) {
    /* Keep only Filename + Actions visible; hide Size, Date too on very small screens */
    #docsTable th:nth-child(4),
    #docsTable td:nth-child(4),
    #docsTable th:nth-child(7),
    #docsTable td:nth-child(7) {
        display: none;
    }

    /* Even larger touch targets for phones */
    #docsTable .actions .btn,
    #docsTable .actions form .btn {
        min-width: 44px;
        min-height: 44px;
        padding: 8px 12px !important;
    }

    /* Grid cards — single column on very small screens */
    .file-grid {
        grid-template-columns: 1fr !important;
    }

    /* Bulk toolbar — more compact */
    .bulk-actions .btn {
        flex: 1;
        min-width: 0;
        text-align: center;
        font-size: 0.75rem;
    }
    .bulk-actions span:first-child {
        font-size: 0.8rem;
    }
}

/* Card spacing */
.page-content .card {
    margin-bottom: 20px;
}

/* ========== PRODUCTIVITY MODULE ========== */

.pd-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.pd-toolbar .btn {
    font-size: 0.85rem;
}

.pd-toolbar-form {
    display: flex;
    gap: 6px;
    align-items: center;
}

.pd-toolbar-form input[type="date"] {
    padding: 5px 10px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 0.85rem;
}

.pd-toolbar-range {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-left: auto;
}

.pd-period-label {
    font-size: 0.85rem;
    color: var(--gray-500);
}

/* Back navigation */
.pd-back {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.pd-back-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gray-800);
}

.pd-back-role {
    font-size: 0.82rem;
    color: var(--gray-500);
}

/* Ring + stat cards */
.pd-rings {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.pd-ring-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    padding: 18px 12px;
    text-align: center;
}

.pd-ring {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pd-ring-hole {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gray-800);
}

.pd-ring-num {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--gray-800);
    line-height: 1.2;
}

.pd-ring-label {
    font-size: 0.72rem;
    color: var(--gray-500);
    margin-top: 2px;
}

/* Stacked bar */
.pd-bar-header {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--gray-800);
    margin-bottom: 10px;
}

.pd-stacked-bar {
    display: flex;
    height: 24px;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
}

.pd-bar-seg {
    transition: width 0.3s;
}
.pd-bar-seg-done { background: var(--success); }
.pd-bar-seg-progress { background: var(--primary); }
.pd-bar-seg-pending { background: var(--warning); }
.pd-bar-seg-late { background: var(--danger); }
.pd-bar-seg-other { background: var(--gray-200); }

.pd-bar-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 0.78rem;
    color: var(--gray-600);
}

.pd-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}
.pd-dot-done { background: var(--success); }
.pd-dot-progress { background: var(--primary); }
.pd-dot-pending { background: var(--warning); }
.pd-dot-late { background: var(--danger); }

/* Inline metric strip */
.pd-metric-strip {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 12px;
}

.pd-metric-strip strong {
    color: var(--gray-800);
}

/* Summary strip */
.pd-summary {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: var(--gray-500);
}

.pd-summary strong {
    color: var(--gray-800);
    font-weight: 700;
}

.pd-summary-div {
    width: 1px;
    height: 20px;
    background: var(--gray-300);
}

/* Small avatar for table */
.pd-avatar-sm {
    display: inline-flex;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-weight: 700;
    font-size: 0.75rem;
    align-items: center;
    justify-content: center;
    margin-right: 6px;
    vertical-align: middle;
}

.pd-role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--gray-100);
    font-size: 0.75rem;
    color: var(--gray-600);
}

/* Progress bar in table */
.pd-progress {
    display: inline-block;
    width: 70px;
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    vertical-align: middle;
    margin-right: 6px;
}

.pd-progress-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--success);
    transition: width 0.3s;
}

.pd-progress-pct {
    font-size: 0.75rem;
    color: var(--gray-500);
    vertical-align: middle;
}

/* Clickable table row */
.pd-tbl-row {
    cursor: pointer;
    transition: background 0.1s;
}
.pd-tbl-row:hover {
    background: var(--gray-50);
}

/* Detail 2-column grid */
.pd-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.pd-section-div {
    height: 1px;
    background: var(--gray-200);
    margin: 12px 0;
}

/* Section title within detail */
.pd-section-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 12px 0;
    color: var(--gray-800);
}

.pd-wrap {
    overflow-x: auto;
}

/* metric grid */
.pd-mg-lead {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2px;
}

.pd-mg-lead-lbl {
    font-size: 0.72rem;
    color: var(--gray-500);
    margin-top: 4px;
}

.pd-mg {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.pd-mg-item {
    background: var(--gray-50);
    border-radius: 8px;
    padding: 14px 10px;
    text-align: center;
}

.pd-mg-num {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gray-800);
}

.pd-mg-lbl {
    display: block;
    font-size: 0.7rem;
    color: var(--gray-500);
    margin-top: 2px;
}

.pd-ring-lg {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pd-ring-hole-lg {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--gray-800);
}

/* Attendance session list */
.pd-session-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pd-session {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.85rem;
}

.pd-session:hover {
    border-color: var(--gray-300);
}

.pd-session.pd-session-on {
    border-left: 3px solid var(--success);
}

.pd-session-date {
    font-weight: 600;
    color: var(--gray-800);
    min-width: 60px;
}

.pd-session-time {
    color: var(--gray-700);
    min-width: 70px;
}

.pd-session-dur {
    font-weight: 700;
    color: var(--gray-800);
    min-width: 55px;
}

.pd-session-end {
    color: var(--gray-600);
    min-width: 70px;
}

.pd-session-note {
    color: var(--gray-500);
    flex: 1;
    font-size: 0.8rem;
}

.pd-session-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    background: #d1fae5;
    color: #065f46;
}

.pd-session-empty {
    text-align: center;
    padding: 24px;
    color: var(--gray-500);
    font-size: 0.85rem;
}

/* Metric strip with icon */
.pd-strip-icon {
    width: 28px;
    color: var(--gray-500);
    text-align: center;
    flex-shrink: 0;
}

/* ========== ATTENDANCE MODULE ========== */

.stat-icon.gray {
    background: var(--gray-400);
    color: white;
}

.att-bar {
    display: flex;
    gap: 10px;
    align-items: center;
}

.att-since {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.att-cal {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.att-cal-hdr {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--gray-600);
    text-align: center;
    padding: 8px 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.att-cal-cell {
    padding: 6px;
    border-radius: 6px;
    text-align: center;
    font-size: 0.85rem;
    min-height: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.att-cal-day {
    font-weight: 600;
}

.att-cal-hours {
    font-size: 0.6rem;
    font-weight: 600;
    margin-top: 1px;
    opacity: 0.85;
}

.att-cal-sessions {
    font-size: 0.55rem;
    opacity: 0.7;
}

.att-cal-empty {
    padding: 6px;
    min-height: 48px;
}

.att-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    font-size: 0.75rem;
    color: var(--gray-500);
}

.att-legend-swatches {
    display: flex;
    gap: 3px;
}

.att-legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

.att-user-select {
    width: auto;
    min-width: 130px;
    flex: 0 0 auto;
}

.att-active {
    color: var(--success);
    font-weight: 600;
}

.att-note {
    color: var(--gray-500);
    font-size: 0.85rem;
}

.att-table-body {
    padding: 0;
}

.att-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    align-items: end;
}

.att-form .form-group {
    margin: 0;
}

/* Evaluation Module */
.ev-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--gray-200);
}

.ev-tab {
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-500);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

.ev-tab:hover { color: var(--gray-700); }

.ev-tab-active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.ev-overall {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    margin-left: 12px;
}

.ev-metrics { font-size: 0.85rem; }

.ev-metric-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.ev-metric-item {
    background: var(--gray-50);
    border-radius: 6px;
    padding: 10px 8px;
    text-align: center;
}

.ev-metric-icon {
    font-size: 0.85rem;
    color: var(--gray-400);
    display: block;
    margin-bottom: 2px;
}

.ev-metric-val {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-800);
}

.ev-metric-lbl {
    display: block;
    font-size: 0.65rem;
    color: var(--gray-500);
    margin-top: 1px;
}

.ev-comment {
    padding: 10px 12px;
    border-left: 3px solid var(--gray-200);
    margin-bottom: 10px;
    background: var(--gray-50);
    border-radius: 0 6px 6px 0;
}

.ev-comment-mgmt {
    border-left-color: var(--warning);
    background: #fffbeb;
}

.ev-comment-hdr {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.ev-comment-body {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--gray-700);
}

/* badge-primary (for submitted status) */
.badge-primary {
    background: #dbeafe;
    color: #1e40af;
}

/* Locked weight slider */
.kpi-weight-slider.ev-locked {
    opacity: 0.5;
    pointer-events: none;
}

