/* ============================================
   LUNAR - Futuristic Black & White Theme
   ============================================ */

/* --- CSS Reset & Variables --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Default Dark Selection */
::selection {
    background: #ffffff;
    color: #000000;
    text-shadow: none;
}

::-moz-selection {
    background: #ffffff;
    color: #000000;
    text-shadow: none;
}

/* Light Theme Selection Overrides */
[data-theme="light"] ::selection,
[data-theme="light"] *::selection {
    background: #cccccc;
    color: #000000;
    text-shadow: none;
}

[data-theme="light"] ::-moz-selection,
[data-theme="light"] *::-moz-selection {
    background: #cccccc;
    color: #000000;
    text-shadow: none;
}

:root {
    /* Monochrome Palette */
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;
    --bg-card: #0f0f0f;

    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #666666;

    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.2);

    /* Accent - Subtle White Glow */
    --accent: #ffffff;
    --accent-glow: rgba(255, 255, 255, 0.1);
    --accent-soft: rgba(255, 255, 255, 0.05);

    /* Dimensions */
    --header-height: 70px;
    --sidebar-width: 280px;
    --border-radius: 12px;
    --border-radius-sm: 8px;

    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e8e8e8;
    --bg-card: #ffffff;

    --text-primary: #0a0a0a;
    --text-secondary: #444444;
    --text-muted: #888888;

    --border-color: rgba(0, 0, 0, 0.1);
    --border-hover: rgba(0, 0, 0, 0.2);

    --accent: #0a0a0a;
    --accent-glow: rgba(0, 0, 0, 0.1);
    --accent-soft: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] body::before {
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
}

[data-theme="light"] body::after {
    background: radial-gradient(circle, rgba(0, 0, 0, 0.03) 0%, transparent 70%);
}

[data-theme="light"] .lunar-header {
    background: rgba(245, 245, 245, 0.9);
}

/* Theme Toggle Button */
.theme-toggle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: var(--transition-normal);
}

.theme-toggle:hover {
    background: var(--accent-soft);
    border-color: var(--border-hover);
    transform: rotate(15deg);
}

/* --- Base --- */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated Background Grid */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: -1;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(50px, 50px);
    }
}

/* Floating Orbs */
body::after {
    content: '';
    position: fixed;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.03) 0%, transparent 70%);
    top: -200px;
    right: -200px;
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
    animation: float 15s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(-50px, 50px) scale(1.1);
    }
}

/* --- Typography --- */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 1.75rem;
}

h3 {
    font-size: 1.25rem;
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition-fast);
}

/* --- Layout --- */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* --- Header --- */
.lunar-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: var(--transition-normal);
}

.lunar-header:hover {
    border-bottom-color: var(--border-hover);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0.2em;
    color: var(--text-primary);
    position: relative;
    padding: 0.5rem 0;
}

.logo::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: var(--transition-normal);
}

.logo:hover::after {
    width: 100%;
}

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

.search-input {
    width: 100%;
    padding: 0.75rem 1.25rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 100px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition-normal);
    outline: none;
}

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

.search-input:focus {
    border-color: var(--border-hover);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

/* Navigation */
.nav-links {
    display: flex;
    gap: 0.75rem;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    white-space: nowrap;
    background: var(--text-primary);
    color: var(--bg-primary);
    border: none;
    border-radius: 100px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(255, 255, 255, 0.1);
}

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

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

.btn-secondary:hover {
    background: var(--accent-soft);
    border-color: var(--border-hover);
    box-shadow: none;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
}

.w-100 {
    width: 100%;
}

.mb-2 {
    margin-bottom: 0.75rem;
}

/* --- Cards --- */
.glass-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: var(--transition-normal);
}

.glass-panel:hover {
    border-color: var(--border-hover);
}

/* File Cards */
.file-card {
    display: block;
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.file-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0;
    transition: var(--transition-normal);
}

.file-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.file-card:hover::before {
    opacity: 1;
}

.file-card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.file-card .meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.file-card .icon {
    font-size: 1.25rem;
}

/* --- Dashboard --- */
main {
    padding-top: calc(var(--header-height) + 5rem);
    padding-bottom: 3rem;
    min-height: 100vh;
}

.dashboard-hero {
    text-align: center;
    padding: 4rem 0;
    position: relative;
}

.pulsing-logo {
    font-size: 4rem;
    font-weight: 900;
    margin-bottom: 0;
    color: var(--text-primary);
    letter-spacing: 0.1em;
    animation: fade-pulse-simple 4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes fade-pulse-simple {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.02;
        transform: scale(0.98);
    }
}

@keyframes pulse-fade-black {

    0%,
    100% {
        opacity: 1;
        filter: brightness(1) drop-shadow(0 0 0 rgba(0, 0, 0, 0));
    }

    50% {
        opacity: 0;
        filter: brightness(0) drop-shadow(0 0 10px rgba(0, 0, 0, 0.5));
    }
}

.dashboard-hero p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 500px;
    margin: 0 auto;
}

.section-title {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

/* --- Browse Page --- */
.browse-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.browse-header h1 {
    font-size: 1.5rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

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

.file-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    transition: var(--transition-normal);
}

.file-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
    transform: translateX(8px);
}

.file-item .icon {
    font-size: 1.5rem;
    opacity: 0.7;
}

.file-item .name {
    flex: 1;
    font-weight: 500;
}

.file-item .arrow {
    opacity: 0;
    transform: translateX(-10px);
    transition: var(--transition-normal);
}

.file-item:hover .arrow {
    opacity: 1;
    transform: translateX(0);
}

/* --- Note/Viewer Page --- */
.viewer-layout {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 1rem;
    height: calc(100vh - var(--header-height) - 4rem);
    margin-top: 2rem;
}

.viewer-sidebar {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.sidebar-header {
    margin-bottom: 2rem;
}

.sidebar-header h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    word-break: break-word;
}

.sidebar-actions {
    margin-top: auto;
}

.viewer-main {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-secondary);
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.pdf-iframe {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: var(--border-radius);
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 100px;
    background: var(--accent-soft);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.status-badge.success {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.3);
}

.status-badge.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

.empty-state h2 {
    margin-bottom: 0.5rem;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .viewer-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .viewer-sidebar {
        order: 2;
    }

    .viewer-main {
        min-height: 70vh;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 60px;
    }

    .header-inner {
        padding: 0 1rem;
    }

    .search-container {
        display: none;
    }

    .container {
        padding: 0 1rem;
    }

    .dashboard-hero h1 {
        font-size: 2rem;
    }

    .file-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* --- Selection --- */
::selection {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

/* --- Loading Animation --- */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* --- Pulse Animation for Interactive Elements --- */
@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.1);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(255, 255, 255, 0);
    }
}

.pulse {
    animation: pulse 2s infinite;
}