/* ==========================================================================
   Web File Browser Stylesheet - sudam.site / jvibeschool.space /FILE/
   ========================================================================== */

:root {
    --bg-main: #090d16;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.85);
    --bg-pill: rgba(255, 255, 255, 0.06);
    --bg-hover: rgba(255, 255, 255, 0.05);
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(99, 102, 241, 0.35);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.35);
    
    --accent-cyan: #06b6d4;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    
    --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 20px 40px -10px rgba(0, 0, 0, 0.6);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;
    
    --font-heading: 'Outfit', 'Pretendard', sans-serif;
    --font-body: 'Pretendard', system-ui, sans-serif;
    --font-code: 'Fira Code', monospace;
}

[data-theme="light"] {
    --bg-main: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-pill: rgba(0, 0, 0, 0.05);
    --bg-hover: rgba(0, 0, 0, 0.03);
    
    --border-color: rgba(203, 213, 225, 0.8);
    --border-highlight: rgba(79, 70, 229, 0.4);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --primary: #4f46e5;
    --primary-hover: #4338ca;
}

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

html, body {
    font-family: var(--font-body);
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

/* --- Login Screen --- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: radial-gradient(circle at 50% 30%, rgba(99, 102, 241, 0.15), transparent 70%);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-highlight);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), var(--accent-cyan));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    box-shadow: 0 0 20px var(--primary-glow);
}

.login-icon svg {
    width: 30px;
    height: 30px;
}

.login-header h2 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
}

.login-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.login-alert {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(244, 63, 94, 0.12);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: var(--accent-rose);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    margin-bottom: 1.5rem;
}

.login-alert svg {
    width: 18px;
    height: 18px;
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

.login-form label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.login-form label svg {
    width: 14px;
    height: 14px;
}

.login-form input[type="password"] {
    width: 100%;
    padding: 0.85rem 1rem;
    background: var(--bg-pill);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.login-form input[type="password"]:focus {
    border-color: var(--primary);
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.4rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

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

.btn-logout {
    background: rgba(244, 63, 94, 0.12);
    color: var(--accent-rose);
    border: 1px solid rgba(244, 63, 94, 0.2);
}

.btn-logout:hover {
    background: rgba(244, 63, 94, 0.2);
}

.login-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 1.5rem;
}

.login-footer svg {
    width: 14px;
    height: 14px;
}

/* --- Main Interface Navbar --- */
.fb-navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 1.5rem;
}

.fb-nav-container {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.fb-logo {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.logo-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), var(--accent-cyan));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon svg {
    width: 20px;
    height: 20px;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
}

.badge-readonly {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--accent-emerald);
    border-radius: var(--radius-full);
}

.badge-readonly svg {
    width: 12px;
    height: 12px;
}

.fb-nav-actions {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.theme-toggle-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: var(--bg-pill);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.sun-icon { display: none; width: 18px; height: 18px; color: var(--accent-amber); }
.moon-icon { display: block; width: 18px; height: 18px; color: var(--primary); }

[data-theme="light"] .sun-icon { display: block; }
[data-theme="light"] .moon-icon { display: none; }

/* --- Main Layout --- */
.fb-main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.fb-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.breadcrumbs-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-md);
    flex: 1;
    min-width: 300px;
}

.breadcrumbs-bar svg {
    width: 18px;
    height: 18px;
    color: var(--accent-amber);
}

.breadcrumbs-list {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    font-weight: 500;
}

.bc-sep svg {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

.bc-item:hover {
    color: var(--primary);
    text-decoration: underline;
}

.search-box {
    position: relative;
    width: 280px;
}

.search-box svg {
    position: absolute;
    top: 50%;
    left: 0.85rem;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 0.65rem 0.85rem 0.65rem 2.4rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.88rem;
    outline: none;
}

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

/* --- File Table --- */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.file-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.file-table th {
    background: var(--bg-secondary);
    padding: 0.85rem 1.25rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.82rem;
    border-bottom: 1px solid var(--border-color);
}

.file-table td {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

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

.file-row:hover {
    background: var(--bg-hover);
}

.file-link {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    font-weight: 500;
    cursor: pointer;
}

.file-link:hover .file-name {
    color: var(--primary);
}

.icon-dir {
    color: var(--accent-amber);
    width: 20px;
    height: 20px;
}

.icon-file {
    color: var(--accent-cyan);
    width: 20px;
    height: 20px;
}

.col-muted {
    color: var(--text-secondary);
    font-size: 0.86rem;
}

.col-muted code {
    font-family: var(--font-code);
    background: var(--bg-pill);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.action-buttons {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--bg-pill);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn svg {
    width: 15px;
    height: 15px;
}

.action-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.12);
}

.empty-cell {
    text-align: center;
    padding: 3rem !important;
    color: var(--text-muted);
}

.empty-cell svg {
    width: 36px;
    height: 36px;
    margin-bottom: 0.5rem;
}

/* --- Modal Backdrop & Viewer --- */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-highlight);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 850px;
    padding: 1.8rem;
    position: relative;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.modal-backdrop.show .modal-box {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    color: var(--text-muted);
    border: none;
    background: none;
    cursor: pointer;
}

.modal-close svg {
    width: 22px;
    height: 22px;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.modal-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-icon svg {
    width: 20px;
    height: 20px;
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    word-break: break-all;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    font-family: var(--font-code);
    font-size: 0.88rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
}

.modal-body img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: var(--radius-sm);
}

.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    color: var(--text-muted);
    padding: 2rem 0;
}

.spin-icon {
    animation: spin 1.5s linear infinite;
}

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

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}
