﻿/* =====================================================
   SAGANEST — BASE STYLES
   Reset, variables, scrollbar, toasts, motion
   ===================================================== */

/* ================= RESET ================= */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    overflow-x: clip;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                 Oxygen, Ubuntu, Cantarell, Arial, Helvetica, sans-serif;
    background: #0d0d12;
    color: #ffffff;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: clip;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img, svg, video {
    display: block;
    max-width: 100%;
}

button, input, textarea, select {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

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

ul, ol {
    list-style: none;
}

/* ================= CSS VARIABLES ================= */
:root {
    --bg-primary: #0d0d12;
    --bg-secondary: #15151c;
    --bg-card: #17171f;
    --bg-elevated: #1c1c25;
    --bg-input: #0d0d12;

    --border-subtle: #25252d;
    --border-default: #292932;
    --border-strong: #35353f;

    --accent: #9b5cff;
    --accent-light: #a86cff;
    --accent-hover: #aa70ff;
    --accent-dark: #6d28d9;
    --accent-soft: rgba(155, 92, 255, 0.12);

    --text-primary: #ffffff;
    --text-secondary: #aaa;
    --text-muted: #888;
    --text-dim: #666;
    --text-faint: #555;

    --success: #58d68d;
    --warning: #e7ad4f;
    --danger: #ff6b6b;
    --info: #3498db;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-pill: 999px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.35);
    --shadow-glow: 0 8px 24px rgba(155, 92, 255, 0.3);

    --transition: 0.25s ease;
    --transition-slow: 0.4s ease;
}

/* ================= SCROLLBAR ================= */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #15151c; }
::-webkit-scrollbar-thumb { background: #3a3a48; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #9b5cff; }

::selection {
    background: rgba(155, 92, 255, 0.35);
    color: #fff;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ================= TOASTS ================= */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
    width: calc(100% - 48px);
    pointer-events: none;
}

.toast {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toastSlideUp 0.35s cubic-bezier(0.21, 1.02, 0.73, 1);
    display: flex;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    pointer-events: auto;
}

.toast-success { background: rgba(39, 174, 96, 0.95); }
.toast-error   { background: rgba(231, 76, 60, 0.95); }
.toast-info    { background: rgba(52, 152, 219, 0.95); }
.toast-warning { background: rgba(241, 196, 15, 0.95); color: #222; }

.toast-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 20px;
    cursor: pointer;
    margin-left: auto;
    opacity: 0.6;
    padding: 0 4px;
    transition: opacity var(--transition);
    line-height: 1;
}

.toast-close:hover { opacity: 1; }

.toast-fade-out {
    opacity: 0;
    transform: translateX(80px);
    transition: all 0.35s ease;
}

@keyframes toastSlideUp {
    from { opacity: 0; transform: translateY(24px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ================= REDUCED MOTION ================= */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ================= PRINT ================= */
@media print {
    .navbar,
    .search-panel,
    .footer-links,
    .login-btn,
    .search-btn,
    .reader-header,
    .reading-progress,
    .reader-actions {
        display: none !important;
    }

    body {
        background: #fff !important;
        color: #000 !important;
        padding-bottom: 0 !important;
    }

    .reader-page { background: #fff !important; }
}