﻿/* Settings Page Specific Styles */

/* Auto-detect system/Shopify theme preference */
@media (prefers-color-scheme: dark) {
    :root:not(.theme-override) {
        color-scheme: dark;
    }
    
    body:not(.theme-override) {
        --page-bg: radial-gradient(1200px 600px at 20% -10%, #1f2937 0%, rgba(31,41,55,0) 60%),
                   radial-gradient(1000px 500px at 100% 0%, #0ea5e9 0%, rgba(14,165,233,0) 40%),
                   linear-gradient(180deg, #0b1020 0%, #0b1220 100%);
        --text: #0f172a;
        --muted: #475569;
        --heading: #0f172a;
        --card-bg: rgba(255,255,255,0.95);
        --card-border: rgba(148,163,184,0.3);
        --shadow-1: 0 6px 24px rgba(2,6,23,0.15);
        --input-bg: #ffffff;
        --input-text: #0f172a;
        --input-border: #cbd5e1;
        --placeholder: #64748b;
        --focus: #2563eb;
        --btn-start: #2563eb;
        --btn-end: #7c3aed;
        --success-bg: rgba(16,185,129,0.12);
        --success-text: #065f46;
        --error-bg: rgba(239,68,68,0.12);
        --error-text: #991b1b;
    }
}

/* ULTRA-SPECIFIC: Force heading to ALWAYS be dark - override everything */
h1,
.header-row h1,
body h1,
html body h1,
body.theme-dark h1,
html body.theme-dark h1,
.header-row h1 span,
body .header-row h1 span,
html body .header-row h1 span {
    color: #0f172a !important;
}

/* Media query version with even higher specificity */
@media (prefers-color-scheme: dark) {
    h1,
    .header-row h1,
    body h1,
    html body h1,
    body:not(.theme-override) h1,
    html body:not(.theme-override) h1,
    .header-row h1 span,
    body .header-row h1 span,
    html body .header-row h1 span,
    body:not(.theme-override) .header-row h1 span {
        color: #0f172a !important;
    }
}

/* Footer Styles - Ensure dark text in dark mode */
.app-footer {
    background: var(--card);
    border-radius: 12px;
    padding: 24px;
    margin-top: 48px;
    text-align: center;
}

.app-footer p {
    color: #1e293b;
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.app-footer p:last-child {
    margin-bottom: 0;
}

.app-footer strong {
    color: #0f172a;
    font-weight: 600;
}

.app-footer a {
    color: var(--focus);
    text-decoration: none;
    font-weight: 500;
}

.app-footer a:hover {
    text-decoration: underline;
}

/* Dark mode: Force dark text in footer */
.theme-dark .app-footer p,
@media (prefers-color-scheme: dark) {
    body:not(.theme-override) .app-footer p {
        color: #1e293b !important;
    }
}

.theme-dark .app-footer strong,
@media (prefers-color-scheme: dark) {
    body:not(.theme-override) .app-footer strong {
        color: #0f172a !important;
    }
}

.theme-dark .app-footer a,
@media (prefers-color-scheme: dark) {
    body:not(.theme-override) .app-footer a {
        color: #2563eb !important;
    }
}

/* Information Banner - Light background with DARK text */
.info-banner {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(124, 58, 237, 0.15));
    border-left: 4px solid var(--focus);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    border: 1px solid rgba(37, 99, 235, 0.2);
}

/* Dark mode: Solid light background with dark text */
.theme-dark .info-banner,
@media (prefers-color-scheme: dark) {
    body:not(.theme-override) .info-banner {
        background: linear-gradient(135deg, rgba(219, 234, 254, 0.98), rgba(233, 213, 255, 0.98));
        border-left: 4px solid #2563eb;
        border: 1px solid rgba(37, 99, 235, 0.4);
    }
}

.info-banner h3 {
    color: #0f172a;
    font-size: 1.15rem;
    margin-bottom: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Force dark text in banner */
.theme-dark .info-banner h3,
@media (prefers-color-scheme: dark) {
    body .info-banner h3 {
        color: #0f172a !important;
    }
}

.info-banner p {
    color: #1e293b;
    margin: 10px 0;
    line-height: 1.7;
    font-size: 0.95rem;
}

/* Force dark text for paragraphs */
.theme-dark .info-banner p,
@media (prefers-color-scheme: dark) {
    body .info-banner p {
        color: #1e293b !important;
    }
}

.info-banner strong {
    color: #1e40af;
    font-weight: 600;
}

/* Force dark blue for strong text */
.theme-dark .info-banner strong,
@media (prefers-color-scheme: dark) {
    body .info-banner strong {
        color: #1e40af !important;
    }
}

.info-banner ul {
    margin: 16px 0 0 24px;
    color: #1e293b;
    list-style: none;
    padding: 0;
}

.info-banner ul li {
    margin: 10px 0;
    padding-left: 28px;
    position: relative;
    line-height: 1.6;
    color: #1e293b;
}

/* Force dark text for list items */
.theme-dark .info-banner ul li,
@media (prefers-color-scheme: dark) {
    body .info-banner ul li {
        color: #1e293b !important;
    }
}

.info-banner ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    width: 18px;
    height: 18px;
    background-size: contain;
    background-repeat: no-repeat;
}

.info-banner ul li:nth-child(1)::before,
.info-banner ul li:nth-child(2)::before {
    content: '✅';
    font-size: 16px;
    line-height: 18px;
}

.info-banner ul li:nth-child(3)::before {
    content: '⚠️';
    font-size: 16px;
    line-height: 18px;
}

/* Modern Theme Toggle Button */
.theme-toggle {
    position: relative;
}

.theme-toggle-btn {
    position: relative;
    width: 64px;
    height: 32px;
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    border: 2px solid #94a3b8;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    padding: 2px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* FIXED: Add proper dark mode toggle background */
.theme-dark .theme-toggle-btn {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border-color: #475569;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3);
}

@media (prefers-color-scheme: dark) {
    body:not(.theme-override) .theme-toggle-btn {
        background: linear-gradient(135deg, #1e293b, #0f172a);
        border-color: #475569;
        box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3);
    }
}

.theme-toggle-btn:hover {
    transform: scale(1.05);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.theme-dark .theme-toggle-btn:hover {
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(6, 182, 212, 0.2);
}

@media (prefers-color-scheme: dark) {
    body:not(.theme-override) .theme-toggle-btn:hover {
        box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(6, 182, 212, 0.2);
    }
}

/* FIXED: Slider position and animation */
.theme-toggle-slider {
    position: absolute;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    left: 4px;
}

/* FIXED: Animated slider movement for dark mode */
.theme-dark .theme-toggle-slider {
    left: calc(100% - 28px);
    background: #0f172a;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
    body:not(.theme-override) .theme-toggle-slider {
        left: calc(100% - 28px);
        background: #0f172a;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    }
}

.theme-icon {
    transition: transform 0.3s ease;
}

.theme-toggle-btn:hover .theme-icon {
    transform: rotate(20deg) scale(1.1);
}

/* Enhanced Save Button Styling */
.save-button-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
}

.button-save {
    position: relative;
    min-width: 280px;
    padding: 18px 48px;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Gradient background */
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 50%, #db2777 100%);
    background-size: 200% 100%;
    background-position: 0% 0%;
    
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    box-shadow: 
        0 4px 12px rgba(37, 99, 235, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.1),
        inset 0 -2px 8px rgba(0, 0, 0, 0.1);
    
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

/* Dark mode adjustments - keep same button styling */
.theme-dark .button-save,
@media (prefers-color-scheme: dark) {
    body:not(.theme-override) .button-save {
        background: linear-gradient(135deg, #2563eb 0%, #7c3aed 50%, #db2777 100%);
        background-size: 200% 100%;
        box-shadow: 
            0 4px 16px rgba(37, 99, 235, 0.4),
            0 2px 4px rgba(0, 0, 0, 0.2),
            inset 0 -2px 8px rgba(0, 0, 0, 0.2);
    }
}

.button-save:hover {
    transform: translateY(-2px) scale(1.02);
    background-position: 100% 0%;
    box-shadow: 
        0 8px 24px rgba(37, 99, 235, 0.5),
        0 4px 8px rgba(0, 0, 0, 0.15),
        inset 0 -2px 8px rgba(0, 0, 0, 0.1);
}

.theme-dark .button-save:hover,
@media (prefers-color-scheme: dark) {
    body:not(.theme-override) .button-save:hover {
        box-shadow: 
            0 8px 28px rgba(37, 99, 235, 0.5),
            0 4px 8px rgba(0, 0, 0, 0.2),
            inset 0 -2px 8px rgba(0, 0, 0, 0.2);
    }
}

.button-save:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 
        0 2px 8px rgba(37, 99, 235, 0.4),
        inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

.button-save:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    background-position: 0% 0%;
}

/* Button icon */
.button-save .icon {
    font-size: 1.3rem;
    transition: transform 0.3s ease;
}

.button-save:hover .icon {
    transform: scale(1.2) rotate(5deg);
}

.button-save:active .icon {
    transform: scale(1) rotate(0deg);
}

/* Loading spinner */
.button-save.loading .icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Shimmer effect */
.button-save::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transition: left 0.5s ease;
}

.button-save:hover::before {
    left: 100%;
}

/* Pulse animation on page load */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 
            0 4px 12px rgba(37, 99, 235, 0.4),
            0 2px 4px rgba(0, 0, 0, 0.1);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 
            0 6px 20px rgba(37, 99, 235, 0.5),
            0 3px 6px rgba(0, 0, 0, 0.15);
    }
}

.button-save.pulse {
    animation: pulse 2s ease-in-out;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .button-save {
        min-width: 100%;
        padding: 16px 32px;
        font-size: 1rem;
    }
}
