/* css/documents.css */

/* Import Inter font */
@import url('https://fonts.googleapis.com/css2?family=Inter:opsz@14..32&display=swap');

* {
    font-family: 'Inter', system-ui, sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #f4f7fb;
}

/* custom navy/teal palette */
.bg-navy-sidebar {
    background-color: #0c2538;
}

.bg-navy-deep {
    background-color: #0b1f33;
}

.text-teal-logo {
    color: #5ee0d0;
}

.border-teal-light {
    border-color: #2aa79b33;
}

/* hover effect for nav items */
.hover-nav:hover {
    background-color: #1f4e5e;
    color: white;
}

/* active navigation item */
.active-nav {
    background-color: #1a4450;
    border-left: 4px solid #2aa79b;
}

/* stat card styles */
.stat-card {
    transition: all 0.2s ease;
    border: 1px solid #eef2f6;
    background-color: white;
    border-radius: 0.75rem;
}

.stat-card:hover {
    box-shadow: 0 8px 20px -8px rgba(18, 79, 86, 0.15);
}

/* dashboard background */
.bg-dashboard-bg {
    background-color: #f4f7fb;
}

/* utility classes */
.text-teal-300 { color: #5eead4; }
.text-teal-300\/70 { color: rgba(94, 234, 212, 0.7); }
.bg-teal-800\/40 { background-color: rgba(17, 94, 89, 0.4); }
.border-teal-400 { border-color: #2dd4bf; }

/* badge styles */
.badge-approved, .badge-pending, .badge-draft, .badge-expired, .badge-validated, .badge-rejected, .badge-locked,
.badge-iso, .badge-aaccup, .badge-coe {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 500;
}

.badge-approved { background-color: #e3f7ec; color: #0f7b4b; }
.badge-pending { background-color: #fef9e7; color: #b78103; }
.badge-validated { background-color: #dbeafe; color: #1e40af; }
.badge-draft { background-color: #edf2f7; color: #385d7a; }
.badge-rejected { background-color: #fee2e2; color: #dc2626; }
.badge-locked { background-color: #f3f4f6; color: #6b7280; }
.badge-expired { background-color: #fee9e7; color: #b33f2f; }
.badge-iso { background-color: #f0fdfa; color: #0f766e; }
.badge-aaccup { background-color: #fef3c7; color: #b45309; }
.badge-coe { background-color: #e0e7ff; color: #4338ca; }

/* Category badges */
.badge-instruction {
    background-color: #dbeafe;
    color: #1d4ed8;
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 500;
}

.badge-research {
    background-color: #dcfce7;
    color: #15803d;
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 500;
}

.badge-extension {
    background-color: #fef3c7;
    color: #b45309;
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 500;
}

.badge-employment {
    background-color: #f3e8ff;
    color: #7e22ce;
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 500;
}

/* Department Badge */
.badge-department {
    background-color: #e0e7ff;
    color: #4338ca;
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 500;
}

/* ============================================ */
/* COLORED ACTION BUTTONS */
/* ============================================ */

/* View Button - Gray (neutral) */
.btn-view, .btn-view-sm {
    background-color: #f3f4f6;
    border: 1px solid #e5e7eb;
    padding: 0.3rem 0.85rem;
    border-radius: 0.375rem;
    font-size: 0.7rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-view:hover, .btn-view-sm:hover {
    background-color: #e5e7eb;
    border-color: #d1d5db;
}

/* Details Button - Teal/Blue (info) */
.btn-details, .btn-details-sm {
    background-color: #e0f2fe;
    border: 1px solid #bae6fd;
    padding: 0.3rem 0.85rem;
    border-radius: 0.375rem;
    font-size: 0.7rem;
    font-weight: 500;
    color: #0369a1;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-details:hover, .btn-details-sm:hover {
    background-color: #bae6fd;
    border-color: #7dd3fc;
}

/* Download Button - Green */
.btn-download, .btn-download-sm {
    background-color: #dcfce7;
    border: 1px solid #bbf7d0;
    padding: 0.3rem 0.85rem;
    border-radius: 0.375rem;
    font-size: 0.7rem;
    font-weight: 500;
    color: #16a34a;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-download:hover, .btn-download-sm:hover {
    background-color: #bbf7d0;
}

/* Delete Button - Red */
.btn-delete, .btn-delete-sm {
    background-color: #fee2e2;
    border: 1px solid #fecaca;
    padding: 0.3rem 0.85rem;
    border-radius: 0.375rem;
    font-size: 0.7rem;
    font-weight: 500;
    color: #dc2626;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-delete:hover, .btn-delete-sm:hover {
    background-color: #fecaca;
}

/* Comments Button - Blue */
.btn-comments, .btn-comments-sm {
    background-color: #dbeafe;
    border: 1px solid #bfdbfe;
    padding: 0.3rem 0.85rem;
    border-radius: 0.375rem;
    font-size: 0.7rem;
    font-weight: 500;
    color: #1d4ed8;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-comments:hover, .btn-comments-sm:hover {
    background-color: #bfdbfe;
}

/* Lock/Unlock Button - Purple */
.btn-lock, .btn-lock-sm {
    background-color: #f3e8ff;
    border: 1px solid #e9d5ff;
    padding: 0.3rem 0.85rem;
    border-radius: 0.375rem;
    font-size: 0.7rem;
    font-weight: 500;
    color: #9333ea;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-lock:hover, .btn-lock-sm:hover {
    background-color: #e9d5ff;
}

/* Active state for all buttons */
.btn-view:active, .btn-download:active, .btn-details:active,
.btn-delete:active, .btn-lock:active, .btn-comments:active,
.btn-view-sm:active, .btn-download-sm:active, .btn-details-sm:active,
.btn-delete-sm:active, .btn-lock-sm:active, .btn-comments-sm:active {
    transform: scale(0.97);
}

/* Upload button */
.bg-teal-700 {
    background-color: #0f766e;
}
.bg-teal-700:hover {
    background-color: #115e59;
}

/* Table styling */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    font-weight: 600;
    text-align: left;
    font-size: 0.7rem;
    color: #6b7280;
    padding: 0.875rem 1rem;
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    letter-spacing: 0.3px;
}

td {
    padding: 0.875rem 1rem;
    font-size: 0.85rem;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

/* Document row hover effect */
.doc-row {
    transition: background-color 0.2s ease;
}
.doc-row:hover {
    background-color: #f9fafb;
}

/* Mobile header spacer */
.mobile-header-spacer {
    height: 60px;
    width: 100%;
}

/* ============================================ */
/* DELETE CONFIRMATION MODAL */
/* ============================================ */
#deleteConfirmModal {
    backdrop-filter: blur(2px);
}

/* ============================================ */
/* CUSTOM TOAST */
/* ============================================ */
.custom-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    z-index: 10000;
    font-size: 14px;
    font-weight: 500;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ============================================ */
/* RESPONSIVE DESIGN */
/* ============================================ */

/* Sidebar - Mobile Responsive */
@media (max-width: 768px) {
    .w-72 {
        width: 100%;
        max-width: 280px;
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        z-index: 1000;
        transition: left 0.3s ease;
        overflow-y: auto;
    }
    
    .w-72.open {
        left: 0;
    }
    
    main {
        width: 100%;
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
        position: fixed;
        top: 14px;
        left: 14px;
        z-index: 1001;
        background: #0c2538;
        color: white;
        border: none;
        border-radius: 0.5rem;
        padding: 0.5rem 0.875rem;
        cursor: pointer;
        font-size: 1.25rem;
        line-height: 1;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
}

@media (min-width: 769px) {
    .menu-toggle {
        display: none;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
    
    .w-72 {
        position: relative;
        left: 0 !important;
    }
    
    .mobile-header-spacer {
        display: none;
    }
}

/* Filter bar responsive */
@media (max-width: 768px) {
    .flex-wrap {
        flex-direction: column;
    }
    
    select, .flex-1 input {
        width: 100%;
    }
}

/* Header responsive */
@media (max-width: 640px) {
    h1.text-3xl {
        font-size: 1.5rem;
    }
    
    .text-sm.text-gray-500.mt-1 {
        font-size: 0.75rem;
    }
}

/* Action buttons container */
.flex.flex-wrap.gap-2 {
    gap: 0.5rem;
}

/* Table overflow for mobile */
@media (max-width: 768px) {
    .overflow-x-auto {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Touch-friendly improvements */
@media (max-width: 768px) {
    button, a, .btn-view, .btn-download, .btn-details, .btn-delete, .btn-lock, .btn-comments,
    .btn-view-sm, .btn-download-sm, .btn-details-sm, .btn-delete-sm, .btn-lock-sm, .btn-comments-sm {
        min-height: 40px;
        min-width: 40px;
    }
    
    .overflow-y-auto {
        -webkit-overflow-scrolling: touch;
    }
    
    body {
        font-size: 14px;
    }
}

/* Print styles */
@media print {
    .sidebar, nav, .menu-toggle, .btn-view, .btn-download, .btn-details, .btn-delete, .btn-lock, .btn-comments,
    .btn-view-sm, .btn-download-sm, .btn-details-sm, .btn-delete-sm, .btn-lock-sm, .btn-comments-sm {
        display: none !important;
    }
    
    main {
        margin: 0;
        padding: 0;
    }
    
    .stat-card {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ============================================ */
/* DOCUMENT DETAILS MODAL */
/* ============================================ */
#docDetailsModal {
    backdrop-filter: blur(2px);
}

#docDetailsContent {
    scrollbar-width: thin;
}

#docDetailsContent::-webkit-scrollbar {
    width: 6px;
}

#docDetailsContent::-webkit-scrollbar-track {
    background: #e2e8f0;
    border-radius: 10px;
}

#docDetailsContent::-webkit-scrollbar-thumb {
    background: #0d9488;
    border-radius: 10px;
}

/* ============================================ */
/* REJECTION/COMMENTS MODAL */
/* ============================================ */
.rejection-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.rejection-modal.active { opacity: 1; visibility: visible; }
.rejection-modal:not(.hidden) { display: flex !important; }
.rejection-modal.hidden { display: none !important; }

.rejection-modal-container {
    background-color: white;
    width: 100%;
    max-width: 600px;
    margin-top: 0;
    border-radius: 0 0 1rem 1rem;
    box-shadow: 0 20px 35px -10px rgba(0,0,0,0.2);
    transform: translateY(-100%);
    transition: transform 0.4s cubic-bezier(0.68,-0.55,0.265,1.55);
    overflow: hidden;
}
.rejection-modal.active .rejection-modal-container { transform: translateY(0); }

.rejection-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #123a4d 0%, #1f5a6e 100%);
    color: white;
}
.rejection-modal-header h2 { 
    font-size: 1.1rem; 
    font-weight: 600; 
    margin: 0; 
}
.modal-close-btn {
    background: none; 
    border: none; 
    color: white;
    font-size: 1.75rem; 
    cursor: pointer;
    width: 32px; 
    height: 32px;
    display: flex; 
    align-items: center; 
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}
.modal-close-btn:hover { 
    background-color: rgba(255,255,255,0.2); 
}

.rejection-modal-body { 
    padding: 1.5rem; 
    max-height: 60vh; 
    overflow-y: auto; 
}

.info-section {
    background-color: #f8fafc;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1.25rem;
    border: 1px solid #e2e8f0;
}
.info-row { 
    display: flex; 
    padding: 0.5rem 0; 
    border-bottom: 1px solid #e2e8f0; 
}
.info-row:last-child { 
    border-bottom: none; 
}
.info-label { 
    width: 40%; 
    font-size: 0.78rem; 
    font-weight: 600; 
    color: #475569; 
}
.info-value { 
    width: 60%; 
    font-size: 0.82rem; 
    color: #1e293b; 
    font-weight: 500; 
}

.comment-section { 
    margin-top: 0.25rem; 
}
.comment-label { 
    display: block; 
    font-size: 0.82rem; 
    font-weight: 600; 
    color: #334155; 
    margin-bottom: 0.6rem; 
}

.comments-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.75rem;
    background-color: #f8fafc;
}

.comment-item {
    background-color: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}
.comment-item:last-child { 
    margin-bottom: 0; 
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.comment-reviewer {
    font-size: 0.8rem;
    font-weight: 600;
    color: #0f766e;
}

.comment-date {
    font-size: 0.7rem;
    color: #94a3b8;
}

.comment-text {
    font-size: 0.82rem;
    color: #334155;
    line-height: 1.5;
}

.rejection-modal-footer {
    display: flex; 
    justify-content: flex-end; 
    gap: 0.75rem;
    padding: 1rem 1.5rem 1.5rem;
    background-color: #f8fafc;
    border-top: 1px solid #e2e8f0;
}
.btn-cancel {
    padding: 0.55rem 1.2rem; 
    background-color: white;
    border: 1px solid #cbd5e1; 
    border-radius: 0.5rem;
    font-size: 0.8rem; 
    font-weight: 500; 
    color: #475569; 
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-cancel:hover { 
    background-color: #f1f5f9; 
}

@media (max-width: 768px) {
    .rejection-modal-container { 
        max-width: 95%; 
        margin: 0 0.5rem; 
    }
    .info-row { 
        flex-direction: column; 
        padding: 0.4rem 0; 
    }
    .info-label, .info-value { 
        width: 100%; 
    }
    .rejection-modal-footer { 
        flex-direction: column-reverse; 
    }
    .btn-cancel { 
        width: 100%; 
        text-align: center; 
    }
}