/* APFHRM Centralized Document Management & Collaboration Portal */
/* Design System & Unified Stylesheet */

:root {
    /* Color Palette - Light, Colorful & Professional Theme */
    --bg-dark: #f0f4f8; /* Soft blue-gray light background */
    --bg-panel: rgba(255, 255, 255, 0.85); /* Frosted white panel */
    --border-color: rgba(0, 0, 0, 0.08); /* Subtle dark border */
    --border-glow: rgba(79, 70, 229, 0.15); /* Soft indigo glow */
    
    --text-primary: #1f2937; /* Charcoal dark text */
    --text-secondary: #4b5563; /* Slate gray text */
    --text-muted: #8c9ba5; /* Muted gray text */
    
    --accent: #4f46e5; /* Vibrant indigo */
    --accent-hover: #3730a3; /* Deep indigo */
    --accent-glow: rgba(79, 70, 229, 0.08); /* Soft indigo highlight */
    
    --success: #10b981; /* Emerald green */
    --success-glow: rgba(16, 185, 129, 0.08);
    --danger: #ef4444; /* Crimson red */
    --danger-glow: rgba(239, 68, 68, 0.08);
    --warning: #d97706; /* Dark amber */
    --warning-glow: rgba(217, 119, 6, 0.08);
    
    /* Layout Variables */
    --sidebar-width: 240px; /* Reduced from 280px to save horizontal space */
    --header-height: 70px;
    --transition-speed: 0.25s;

    /* Theme adaptive element backgrounds */
    --hover-bg: rgba(0, 0, 0, 0.04);
    --hover-bg-strong: rgba(0, 0, 0, 0.08);
    --card-bg-subtle: rgba(255, 255, 255, 0.9);
    --input-bg: #ffffff;
    --btn-secondary-hover-bg: rgba(0, 0, 0, 0.06);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    background: radial-gradient(circle at 50% 0%, #e0e7ff 0%, var(--bg-dark) 70%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

a, button {
    font-family: inherit;
    color: inherit;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.15); }
    50% { box-shadow: 0 0 30px rgba(99, 102, 241, 0.3); }
}

/* Core Dashboard Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Left Sidebar */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
}

.logo-container {
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-glow);
    border: 1px solid var(--border-glow);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.logo-text h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo-text span {
    font-size: 11px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-speed);
}

.nav-item.active a, .nav-item a:hover {
    color: var(--text-primary);
    background: var(--hover-bg);
}

.nav-item.active a {
    border-left: 3px solid var(--accent);
    background: var(--accent-glow);
    color: var(--accent);
}

.user-profile-section {
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-card {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--accent-glow);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 1px solid var(--border-glow);
}

.profile-info {
    overflow: hidden;
}

.profile-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.profile-role {
    font-size: 11px;
    color: var(--text-secondary);
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-speed);
}

.btn-logout:hover {
    background: var(--danger);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

/* Main content pane */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    min-width: 0;
    min-height: 100vh;
    padding: 30px 40px;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Top Header Bar */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: var(--header-height);
    margin-bottom: 24px;
}

.page-title h2 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Button UI Components */
.btn-primary, .btn-secondary, .btn-danger-action {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition-speed);
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--btn-secondary-hover-bg);
}

/* Directory Breadcrumbs */
.breadcrumb-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 20px;
    margin-bottom: 24px;
}

.breadcrumb-item {
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: color var(--transition-speed);
}

.breadcrumb-item:hover {
    color: var(--text-primary);
}

.breadcrumb-item.active {
    color: var(--accent);
    font-weight: 600;
    cursor: default;
}

.breadcrumb-separator {
    color: var(--text-muted);
}

/* Document Repository Grid */
.repo-section-title {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.folder-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-radius: 16px;
    background: var(--card-bg-subtle);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.folder-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    background: var(--btn-secondary-hover-bg);
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.08);
}

.folder-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-speed);
}

.folder-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Documents Table view */
.documents-card {
    flex-grow: 1;
    overflow: hidden;
    margin-bottom: 20px;
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.documents-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.documents-table th, .documents-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}

.documents-table th {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    font-weight: 600;
}

.documents-table tr:last-child td {
    border-bottom: none;
}

.documents-table tbody tr {
    transition: background var(--transition-speed);
}

.documents-table tbody tr:hover {
    background: var(--hover-bg);
}

.doc-title-cell {
    display: flex;
    align-items: center;
    gap: 16px;
}

.doc-icon {
    color: var(--accent);
}

.doc-title-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: 300px;
}

.doc-desc-text {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Constrain the Name column so very long titles don't overflow */
.documents-table td:first-child {
    max-width: 0;
    width: 40%;
    overflow: hidden;
}

.doc-meta-cell {
    font-size: 13px;
    color: var(--text-secondary);
}

.doc-actions-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.action-icon-btn:hover {
    color: var(--accent);
    background: var(--btn-secondary-hover-bg);
    border-color: var(--accent);
}

.action-icon-btn.btn-delete:hover {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
    background: var(--danger-glow);
}

.action-icon-btn.btn-share:hover {
    color: var(--accent);
    border-color: rgba(99, 102, 241, 0.2);
    background: var(--accent-glow);
}

.empty-state {
    padding: 60px 40px;
    text-align: center;
    color: var(--text-secondary);
}

.empty-state-icon {
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* Modals Overlay & Body */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-container {
    width: 100%;
    max-width: 500px;
    margin: 20px;
    border-radius: 20px;
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-container {
    transform: translateY(0);
}

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

.modal-title {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
}

.modal-body {
    padding: 24px;
}

/* Form Styling */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all var(--transition-speed);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Secure Dropzone File Uploader */
.dropzone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.01);
    transition: all var(--transition-speed);
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.dropzone-icon {
    color: var(--text-muted);
    margin-bottom: 12px;
}

.dropzone-text {
    font-size: 14px;
    color: var(--text-secondary);
}

.selected-file-preview {
    margin-top: 16px;
    padding: 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
}

/* Version & Audit items list */
.list-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 4px;
}

.list-item {
    padding: 14px;
    background: var(--card-bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.item-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.item-title {
    font-size: 14px;
    font-weight: 600;
}

.item-desc {
    font-size: 11px;
    color: var(--text-secondary);
}

.item-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Toast Messages */
.toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast.success {
    background: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.toast.error {
    background: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Document Summary & 2-Column Workspace Layout */
.workspace-layout {
    display: flex;
    gap: 28px;
    align-items: flex-start;
    width: 100%;
}

.workspace-main {
    flex: 1 1 0%;
    min-width: 0;
    overflow: hidden;
}

.workspace-summary-panel {
    width: 300px;
    flex-shrink: 0;
    position: sticky;
    top: 30px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: fadeIn 0.4s ease forwards;
}

.summary-header {
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.summary-icon {
    width: 48px;
    height: 48px;
    background: var(--accent-glow);
    border: 1px solid var(--border-glow);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.summary-title-container {
    overflow: hidden;
}

.summary-title {
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    color: var(--text-primary);
}

.summary-subtitle {
    font-size: 11px;
    color: var(--text-secondary);
}

.summary-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.summary-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.summary-text-box {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--text-secondary);
    min-height: 80px;
    word-break: break-word;
}

.summary-text-box.empty {
    font-style: italic;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.summary-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 0;
}

.summary-meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.summary-meta-label {
    font-size: 11px;
    color: var(--text-muted);
}

.summary-meta-value {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.summary-actions-pane {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.summary-actions-pane .btn-primary,
.summary-actions-pane .btn-secondary {
    width: 100%;
    justify-content: center;
    padding: 11px;
    font-size: 13px;
}

/* Selected row highlight state */
.documents-table tbody tr.selected {
    background: rgba(99, 102, 241, 0.08);
    border-left: 3px solid var(--accent);
}

.documents-table tbody tr.selected td {
    color: var(--text-primary);
}

/* Responsive Media Queries */
@media (max-width: 1100px) {
    .workspace-layout {
        flex-direction: column;
    }
    .workspace-summary-panel {
        width: 100%;
        position: static;
    }
}

@media (max-width: 900px) {
    .sidebar {
        width: 80px;
        padding: 20px 10px;
    }
    
    .logo-text, .profile-info, .nav-item span {
        display: none;
    }
    
    .main-content {
        margin-left: 80px;
        padding: 20px;
    }
    
    .nav-item a {
        justify-content: center;
        padding: 12px;
    }

    .calendar-layout-grid {
        grid-template-columns: 1fr !important;
    }
}


@media (max-width: 1300px) {
    .documents-table th:nth-child(4),
    .documents-table td:nth-child(4),
    .documents-table th:nth-child(5),
    .documents-table td:nth-child(5) {
        display: none;
    }
}

@media (max-width: 600px) {
    .top-header {
        flex-direction: column;
        align-items: flex-start;
        height: auto;
        gap: 12px;
        margin-bottom: 16px;
    }
}

/* Typing Indicator Animation */
.typing-indicator {
    display: inline-block;
    font-style: italic;
    color: var(--text-muted);
}
.typing-indicator::after {
    content: '...';
    display: inline-block;
    animation: blink 1.4s infinite both;
    width: 1em;
    text-align: left;
}

@keyframes blink {
    0% { opacity: .2; }
    20% { opacity: 1; }
    100% { opacity: .2; }
}

