@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

/* Color Schemes and Custom Design Tokens */
:root {
    /* Font Families */
    --font-sans: 'Outfit', sans-serif;
    --font-serif: 'Playfair Display', Georgia, serif;

    /* Transition Speeds */
    --transition-fast: 0.2s 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 Tokens (Paper & Asphalt Palette) */
    --bg-primary: #efede3;
    --bg-secondary: #faf8f0;
    --bg-tertiary: #e4e2d5;
    --text-primary: #302f2c;
    --text-secondary: #4a4945;
    --text-muted: #7a7974;
    --accent: #302f2c; /* Asphalt Black Accent */
    --accent-hover: #1e1d1b;
    --accent-gradient: linear-gradient(135deg, #302f2c 0%, #1e1d1b 100%);
    --border-color: #d6d4c5;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --glass-bg: rgba(250, 248, 240, 0.75);
    --glass-border: rgba(239, 237, 227, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(48, 47, 44, 0.05);
}

/* Sepia Theme Mode */
[data-theme="sepia"] {
    --bg-primary: #f4ecd8;
    --bg-secondary: #fbf0d9;
    --bg-tertiary: #ebdcb9;
    --text-primary: #433422;
    --text-secondary: #5c4b37;
    --text-muted: #8c7e6c;
    --accent: #c27803;
    --accent-hover: #a16207;
    --accent-gradient: linear-gradient(135deg, #c27803 0%, #b45309 100%);
    --border-color: #e4d3ab;
    --glass-bg: rgba(251, 240, 217, 0.8);
    --glass-border: rgba(244, 236, 216, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(67, 52, 34, 0.05);
}

/* Dark Theme Mode */
[data-theme="dark"] {
    --bg-primary: #0b0f19;
    --bg-secondary: #111827;
    --bg-tertiary: #1f2937;
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent: #818cf8;
    --accent-hover: #6366f1;
    --accent-gradient: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
    --border-color: #1f2937;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
    --glass-bg: rgba(17, 24, 39, 0.7);
    --glass-border: rgba(255, 255, 255, 0.05);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Base resets & styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.6;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Typography styles */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.25;
    letter-spacing: -0.02em;
}

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

a:hover {
    color: var(--accent-hover);
}

/* Premium Layout & Components */
.gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* Premium Form Input Fields */
label {
    display: block;
    font-size: 0.825rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.input-text {
    display: block;
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 0.95rem;
    font-family: var(--font-sans);
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    outline: none;
    transition: all var(--transition-fast);
    box-shadow: inset 0 1px 2px rgba(48, 47, 44, 0.04);
}

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

.input-text:hover {
    border-color: #b0ae9f;
}

.input-text:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(48, 47, 44, 0.12), inset 0 1px 2px rgba(48, 47, 44, 0.04);
    background-color: var(--bg-secondary);
}

/* Custom Select Dropdowns Styling */
select.input-text {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23302f2c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.1rem;
    padding-right: 2.5rem;
    cursor: pointer;
}

[data-theme="dark"] select.input-text {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f3f4f6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* File selector button custom styling */
input[type="file"].input-text {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
}

input[type="file"].input-text::file-selector-button {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.35rem 0.75rem;
    border-radius: 0.25rem;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    margin-right: 0.75rem;
    transition: all var(--transition-fast);
}

input[type="file"].input-text::file-selector-button:hover {
    background-color: var(--border-color);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    gap: 0.5rem;
}

.btn-primary {
    background: var(--accent-gradient);
    color: #efede3;
    box-shadow: 0 4px 14px 0 rgba(48, 47, 44, 0.15);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(48, 47, 44, 0.25);
}

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

/* Elegant Novel Reader Styles */
.reader-container {
    max-width: 44rem;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
}

.reader-content {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    line-height: 1.85;
    letter-spacing: -0.003em;
    color: var(--text-primary);
}

.reader-content p {
    margin-bottom: 1.75rem;
    text-align: justify;
}

/* Interactive animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn var(--transition-normal) forwards;
}

/* ==========================================
   Elegant Responsive Styles & Overrides
   ========================================== */

/* Utility helper classes */
.responsive-flex {
    display: flex;
    gap: 1rem;
}

/* Global media queries for all devices */
@media (max-width: 1024px) {
    h1 {
        font-size: 2.5rem !important;
    }
}

@media (max-width: 768px) {
    /* Base spacing adjustments */
    body {
        font-size: 15px;
    }

    main {
        padding: 0.75rem !important;
    }

    section {
        margin: 1.5rem auto !important;
        padding: 0 0.75rem !important;
    }

    /* Headings adjustments */
    h1 {
        font-size: 2rem !important;
        line-height: 1.3 !important;
    }

    h2 {
        font-size: 1.5rem !important;
    }

    /* Glass Container Mobile Spacing */
    .glass {
        padding: 1.5rem 1.25rem !important;
        border-radius: 1rem !important;
    }

    /* Responsive Flex Layout overrides */
    .responsive-flex {
        flex-direction: column !important;
        width: 100% !important;
    }

    .responsive-flex > * {
        width: 100% !important;
        text-align: center !important;
        justify-content: center !important;
    }

    /* Navbar stacking beautifully on mobile */
    header > div {
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        padding: 1rem !important;
        gap: 1rem !important;
    }

    header nav {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 1rem !important;
        font-size: 0.9rem !important;
        width: 100% !important;
    }

    header nav a {
        padding: 0.25rem 0.5rem !important;
    }

    header nav .btn {
        width: 100% !important;
        margin-top: 0.25rem !important;
    }

    /* Forms inputs & Filter controls */
    form {
        flex-direction: column !important;
        width: 100% !important;
        gap: 0.75rem !important;
    }

    form > div, form > button {
        flex: unset !important;
        width: 100% !important;
        min-width: 100% !important;
    }

    /* Buttons responsive styling */
    .btn {
        width: 100% !important;
        padding: 0.8rem 1.25rem !important;
        text-align: center !important;
        justify-content: center !important;
    }

    /* Reader responsiveness adjustments */
    .reader-container {
        padding: 1.5rem 0.75rem !important;
    }

    .reader-content {
        font-size: 1.15rem !important;
        line-height: 1.75 !important;
    }

    /* Novel Showcase Card stacking on detail page */
    .glass[style*="display: flex; flex-wrap: wrap;"] {
        flex-direction: column !important;
        align-items: center !important;
        gap: 1.75rem !important;
        padding: 1.5rem !important;
    }

    .glass[style*="display: flex; flex-wrap: wrap;"] > div {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        flex: unset !important;
    }

    /* Center detailed covers on mobile */
    .glass[style*="display: flex; flex-wrap: wrap;"] img {
        max-width: 200px !important;
        margin: 0 auto !important;
    }

    /* Align detail metadata properly on mobile */
    div[style*="display: flex; flex-wrap: wrap; gap: 1.5rem;"] {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    /* Clean chapters list border & spacing */
    a[style*="display: flex; justify-content: space-between;"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5rem !important;
        padding: 1rem !important;
    }

    a[style*="display: flex; justify-content: space-between;"] span:last-child {
        opacity: 0.7;
        font-size: 0.8rem !important;
    }

    /* Clean dashboard layout & statistics widgets */
    .grid-stats {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Settings containers and layout styling */
    .settings-container {
        flex-direction: column !important;
        gap: 1.5rem !important;
    }

    .settings-nav {
        width: 100% !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
    }
}
