/* ===========================
   Noise Texture (Scotech)
   =========================== */
body::after {
  content: '';
  position: fixed; inset: 0; z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none; opacity: 0.6;
}

/* ===========================
   CSS Variables & Reset
   =========================== */
:root {
    /* Navy & Gold theme */
    --navy:      #0f2847;
    --navy2:     #1a3a5c;
    --navy3:     #0b1e35;
    --gold:      #c9a84c;
    --gold2:     #e8c96a;

    --primary: var(--gold);
    --primary-dark: #a8893a;
    --primary-light: var(--gold2);
    --secondary: var(--gold2);
    --danger: #ef4444;
    --success: var(--gold);
    --background: var(--navy3);
    --surface: var(--navy);
    --surface-light: var(--navy2);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #1e3d60;
    --shadow: rgba(0, 0, 0, 0.5);
    --gradient: linear-gradient(135deg, var(--gold) 0%, var(--gold2) 100%);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===========================
   App Container
   =========================== */
.app-container {
    min-height: 100vh;
    max-width: 600px;
    margin: 0 auto;
    padding: 0;
    position: relative;
}

/* ===========================
   Header
   =========================== */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
}

.logo {
    font-size: 1.75rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.settings-btn {
    background: var(--surface-light);
    border: 1px solid var(--border);
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.65rem;
    border-radius: 12px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: rotate(90deg);
}

/* ===========================
   Main Content
   =========================== */
.main-content {
    padding: 2rem 1.5rem;
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================
   Quote Card
   =========================== */
.quote-card {
    background: var(--surface);
    border-radius: 24px;
    padding: 2.5rem 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 40px var(--shadow);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid rgba(201, 168, 76, 0.15);
}

.quote-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: var(--gradient);
}

.quote-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(201, 168, 76, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

.quote-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 50px var(--shadow);
    border-color: rgba(201, 168, 76, 0.35);
}

.quote-content {
    position: relative;
    z-index: 1;
}

.quote-icon {
    color: var(--primary-light);
    opacity: 0.4;
    margin-bottom: 1rem;
}

.quote-text {
    font-size: 1.5rem;
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-weight: 500;
    letter-spacing: -0.3px;
}

.quote-author {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-style: italic;
    font-weight: 400;
}

.quote-date {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
}

/* ===========================
   Action Buttons
   =========================== */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.btn {
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
}

.btn-primary {
    background: var(--gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(201, 168, 76, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(201, 168, 76, 0.4);
}

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

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

.btn-secondary:hover {
    background: var(--surface-light);
    border-color: var(--primary);
}

.btn-danger {
    background: var(--danger);
    color: white;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
}

.btn-danger:hover {
    background: #dc2626;
}

/* ===========================
   Stats Container
   =========================== */
.stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 2rem;
}

.stat-item {
    background: var(--surface);
    border-radius: 20px;
    padding: 1.5rem;
    text-align: center;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.stat-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ===========================
   Modal - Improved Design
   =========================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(8px);
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: var(--surface);
    border-radius: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease-out;
    border: 1px solid var(--border);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.close-btn {
    background: var(--surface-light);
    border: 1px solid var(--border);
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.6rem;
    border-radius: 12px;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.close-btn:hover {
    background: var(--danger);
    border-color: var(--danger);
    transform: rotate(90deg);
}

.modal-body {
    padding: 1.5rem;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: var(--background);
    border-radius: 16px;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.setting-item:hover {
    border-color: var(--primary);
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.setting-info p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Toggle Switch - Modern Design */
.toggle {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 32px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--surface-light);
    transition: var(--transition);
    border-radius: 32px;
    border: 2px solid var(--border);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 3px;
    bottom: 2px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle input:checked + .toggle-slider {
    background: var(--gradient);
    border-color: var(--primary);
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(28px);
}

.installed-badge {
    color: var(--success);
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.installed-badge::before {
    content: '✓';
    display: inline-block;
    width: 24px;
    height: 24px;
    background: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

/* ===========================
   Toast Notification
   =========================== */
.toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: 16px;
    box-shadow: 0 10px 30px var(--shadow);
    z-index: 2000;
    transition: bottom 0.3s ease-out;
    max-width: 90%;
    text-align: center;
    border: 1px solid var(--primary);
}

.toast.show {
    bottom: 2rem;
}

/* ===========================
   Responsive Design
   =========================== */
@media (max-width: 640px) {
    .quote-text {
        font-size: 1.25rem;
    }

    .action-buttons {
        grid-template-columns: 1fr;
    }

    .setting-item {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .stat-value {
        font-size: 1.75rem;
    }
}

/* ===========================
   Loading Animation
   =========================== */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ===========================
   Accessibility
   =========================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ===========================
   Print Styles
   =========================== */
@media print {
    .header,
    .action-buttons,
    .stats-container,
    .settings-btn {
        display: none;
    }

    .quote-card {
        box-shadow: none;
        border: 1px solid #000;
    }
}

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

::-webkit-scrollbar-track {
    background: var(--background);
}

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

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