/* Core Design Tokens */
:root {
    --bg-primary: #0b0f19;
    --panel-bg: rgba(22, 28, 45, 0.55);
    --panel-border: rgba(255, 255, 255, 0.07);
    --panel-border-hover: rgba(255, 255, 255, 0.12);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --color-primary: #6366f1; /* Indigo */
    --color-primary-glow: rgba(99, 102, 241, 0.4);
    --color-secondary: #a855f7; /* Violet */
    --color-success: #10b981; /* Emerald */
    --color-danger: #f43f5e; /* Rose */
    --color-warning: #f59e0b; /* Amber */
    --color-info: #06b6d4; /* Cyan */
    
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --gradient-glow: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
    
    --font-main: 'Inter', sans-serif;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-snappy: all 0.15s ease-out;
}

/* Reset & Global Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Glow Background Decoration */
.background-decor {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.18) 0%, rgba(168, 85, 247, 0.12) 40%, rgba(0, 0, 0, 0) 70%);
    z-index: -1;
    pointer-events: none;
    filter: blur(40px);
}

@keyframes floatBackground {
    0% { transform: translate(-55%, -45%) scale(1); }
    50% { transform: translate(-45%, -55%) scale(1.1); }
    100% { transform: translate(-55%, -45%) scale(1); }
}

.animate-bg {
    animation: floatBackground 12s ease-in-out infinite;
}

/* Glassmorphic Panels */
.glass-panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(16px) saturate(120%);
    -webkit-backdrop-filter: blur(16px) saturate(120%);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
    transition: var(--transition-smooth);
}

/* Buttons */
.btn-primary {
    background: var(--gradient-primary);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.45);
    filter: brightness(1.08);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-snappy);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Navigation & Subfolder Buttons */
.btn-navigate {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-snappy);
}

.btn-navigate:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-navigate.primary-navigate {
    background: rgba(245, 158, 11, 0.1);
    color: #fcd34d;
    border-color: rgba(245, 158, 11, 0.25);
}

.btn-navigate.primary-navigate:hover {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
    transform: translateY(-1px);
}

.btn-navigate.primary-navigate:active {
    transform: translateY(0);
}

/* ------------------- LOGIN LAYOUT ------------------- */
.login-wrapper {
    width: 100%;
    max-width: 440px;
    padding: 24px;
    display: flex;
    justify-content: center;
    animation: fadeIn 0.6s ease-out;
}

.login-card {
    width: 100%;
    padding: 40px 32px;
    border-radius: var(--radius-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo-area {
    display: inline-flex;
    padding: 14px;
    background: var(--gradient-glow);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: var(--radius-md);
    color: var(--color-primary);
    margin-bottom: 16px;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.1);
}

.login-header h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    background: linear-gradient(120deg, #ffffff 30%, #cbd5e1 90%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

/* Forms & Inputs */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.2px;
}

.input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
    transition: var(--transition-snappy);
}

.input-container input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 15px;
    transition: var(--transition-smooth);
}

.input-container input::placeholder {
    color: var(--text-muted);
}

.input-container input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
    background: rgba(15, 23, 42, 0.85);
}

.input-container input:focus + .input-icon {
    color: var(--color-primary);
}

/* Error Alerts */
.error-alert {
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.25);
    color: #fda4af;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: shake 0.4s ease-in-out;
}

.alert-icon {
    flex-shrink: 0;
    color: var(--color-danger);
}


/* ------------------- DASHBOARD LAYOUT ------------------- */
.dashboard-wrapper {
    width: 100%;
    max-width: 900px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: 100vh;
    justify-content: flex-start;
    animation: fadeIn 0.5s ease-out;
}

/* Header Bar */
.header-bar {
    width: 100%;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
}

.header-icon {
    color: var(--color-primary);
}

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

.user-badge {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Stats Area */
.stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 600px) {
    .stats-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

.stat-card {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-details h3 {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: #ffffff;
}

.stat-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.blue-glow {
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.25);
    color: #38bdf8;
}

.purple-glow {
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.25);
    color: #c084fc;
}

/* Explorer Layout */
.explorer-card {
    padding: 30px;
}

.explorer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 20px;
}

@media (max-width: 768px) {
    .explorer-header {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
}

.explorer-title-area {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.explorer-title-area h2 {
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
}

/* Breadcrumbs Styling */
.breadcrumbs-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.breadcrumbs-root-icon {
    color: var(--text-muted);
}

.breadcrumb-item {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition-snappy);
    padding: 2px 4px;
    border-radius: 4px;
}

.breadcrumb-item:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.breadcrumb-item.active {
    color: var(--color-primary);
    font-weight: 600;
    pointer-events: none;
}

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

/* Search Box */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 320px;
}

@media (max-width: 768px) {
    .search-box {
        max-width: 100%;
    }
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 10px 38px 10px 38px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition-smooth);
}

.search-box input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-glow);
    background: rgba(15, 23, 42, 0.75);
}

.search-box input:focus + .search-icon {
    color: var(--color-primary);
}

.clear-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
}

.clear-btn:hover {
    color: var(--text-primary);
}

/* File Listing Container */
.files-container {
    min-height: 200px;
}

.files-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Single File/Folder Row */
.file-row {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    transition: var(--transition-smooth);
}

.file-row:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--panel-border-hover);
    transform: translateX(4px);
}

.folder-row-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.folder-row-link:hover {
    color: inherit;
}

.folder-row-link:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.file-row.parent-row {
    background: rgba(255, 255, 255, 0.01);
    border-style: dashed;
}

.file-info-col {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 2;
    min-width: 0; /* Ensures content truncate works */
}

.file-icon-container {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.file-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.file-name {
    font-size: 15px;
    font-weight: 500;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size-mobile {
    display: none;
    font-size: 12px;
    color: var(--text-secondary);
}

.file-size-col {
    flex: 1;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 400;
    text-align: right;
    padding-right: 24px;
}

.file-action-col {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.file-action-col--empty {
    min-width: 40px;
}

/* Folder Badge styling */
.badge-folder {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #fbd38d;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
}

/* Download Button in List */
.btn-download {
    background: rgba(99, 102, 241, 0.1);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-snappy);
}

.btn-download:hover {
    background: var(--gradient-primary);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
    transform: translateY(-1px);
}

.btn-download:active {
    transform: translateY(0);
}

/* Comment button */
.btn-comment {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    padding: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-snappy);
    flex-shrink: 0;
}

.btn-comment:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-comment.has-comment {
    border-color: var(--color-danger);
    box-shadow: 0 0 0 1px rgba(244, 63, 94, 0.35);
    color: #fda4af;
}

.btn-comment.has-comment:hover {
    border-color: #fb7185;
    background: rgba(244, 63, 94, 0.12);
    color: #fecdd3;
}

/* Comment modal */
.comment-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.comment-modal[hidden] {
    display: none;
}

.comment-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}

.comment-modal-panel {
    position: relative;
    width: 100%;
    max-width: 480px;
    padding: 24px;
    z-index: 1;
    animation: fadeIn 0.2s ease-out;
}

.comment-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.comment-modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
}

.comment-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: var(--transition-snappy);
}

.comment-modal-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.comment-modal-item {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    word-break: break-word;
}

.comment-modal-display {
    padding: 14px 16px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 80px;
}

.comment-modal-display.is-empty {
    color: var(--text-muted);
    font-style: italic;
}

.comment-modal-updated {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.comment-modal-actions--view {
    margin-top: 16px;
}

.comment-modal-edit[hidden],
.comment-modal-updated[hidden] {
    display: none;
}

.comment-modal-textarea {
    width: 100%;
    padding: 12px 14px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    min-height: 120px;
    margin-bottom: 16px;
    transition: var(--transition-smooth);
}

.comment-modal-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.comment-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* File Icon Colors */
.text-red { color: var(--color-danger); }
.text-yellow { color: var(--color-warning); }
.text-green { color: var(--color-success); }
.text-blue { color: var(--color-info); }
.text-gray { color: var(--text-secondary); }

/* SVG icon states inside row */
.icon-file {
    stroke-width: 1.5;
}
.icon-pdf { color: var(--color-danger); }
.icon-zip { color: var(--color-warning); }
.icon-image { color: var(--color-success); }
.icon-text { color: var(--color-info); }
.icon-generic { color: var(--text-secondary); }
.icon-folder { color: var(--color-warning); }
.icon-parent-folder { color: var(--text-secondary); }

/* Responsive adjustments */
@media (max-width: 600px) {
    .file-size-col {
        display: none;
    }
    .file-size-mobile {
        display: block;
    }
    .explorer-card {
        padding: 16px;
    }
    .file-row {
        padding: 12px 14px;
    }
    .btn-download span {
        display: none; /* Only icon on mobile */
    }
    .btn-download {
        padding: 8px;
    }
}

/* States: Empty and No Results */
.empty-state, .no-results-state {
    padding: 48px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

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

.empty-state h3, .no-results-state h3 {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
}

.empty-state p, .no-results-state p {
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 320px;
    line-height: 1.5;
}

.empty-state code {
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--color-secondary);
    font-family: monospace;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}
