/* --- css/style.css --- */
:root {
    /* --- Color Palette (Default Light) --- */
    --primary-blue: #0f2e6b;
    --accent-gold: #fdb933;
    --bg-gradient-start: #1e4c9a;
    --bg-gradient-end: #f0f4f8; 
    --surface-color: #ffffff;
    --text-primary: #0f2e6b;
    --text-secondary: #64748b;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --nav-bg: #ebf3ff; /* Updated to soft blue */
    
    /* Form Specifics */
    --input-bg: #f8fafc;
    --input-border: #cbd5e1;
    --input-text: #0f172a;
    
    /* Dimensions */
    --header-height-large: 8.75rem; 
    --header-height-std: 4.5rem;    
    --border-radius: 1.25rem;       
    --gap-size: 1rem;
}

/* --- Dark Mode Definitions --- */

/* 1. System Preference */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-gradient-start: #0f172a; 
        --bg-gradient-end: #020617;   
        --surface-color: #1e293b;     
        --text-primary: #f8fafc;
        --text-secondary: #94a3b8;
        --shadow-color: rgba(0, 0, 0, 0.5); 
        --nav-bg: #1e293b;
        --input-bg: #0f172a;
        --input-border: #334155;
        --input-text: #f8fafc;
    }
    
    :root:not([data-theme="light"]) .icon-box img {
        filter: brightness(0) saturate(100%) invert(78%) sepia(51%) saturate(718%) hue-rotate(344deg) brightness(103%) contrast(98%);
    }
    :root:not([data-theme="light"]) .text-content p { color: #e2e8f0; }
    :root:not([data-theme="light"]) .tile { border: 1px solid rgba(255, 255, 255, 0.05); }
    :root:not([data-theme="light"]) .primary-btn { background-color: var(--accent-gold); color: #000; }
}

/* 2. Manual Override: Force Dark */
html[data-theme="dark"] {
    --bg-gradient-start: #0f172a; 
    --bg-gradient-end: #020617;   
    --surface-color: #1e293b; 
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --shadow-color: rgba(0, 0, 0, 0.5); 
    --nav-bg: #1e293b;
    --input-bg: #0f172a;
    --input-border: #334155;
    --input-text: #f8fafc;
}

html[data-theme="dark"] .icon-box img {
    filter: brightness(0) saturate(100%) invert(78%) sepia(51%) saturate(718%) hue-rotate(344deg) brightness(103%) contrast(98%);
}
html[data-theme="dark"] .text-content p { color: #e2e8f0; }
html[data-theme="dark"] .tile { border: 1px solid rgba(255, 255, 255, 0.05); }
html[data-theme="dark"] .primary-btn { background-color: var(--accent-gold); color: #000; }

/* 3. Manual Override: Force Light */
html[data-theme="light"] {
    --primary-blue: #0f2e6b;
    --accent-gold: #fdb933;
    --bg-gradient-start: #1e4c9a;
    --bg-gradient-end: #f0f4f8; 
    --surface-color: #ffffff;
    --text-primary: #0f2e6b;
    --text-secondary: #64748b;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --nav-bg: #ebf3ff; /* Updated to soft blue */
    --input-bg: #f8fafc;
    --input-border: #cbd5e1;
    --input-text: #0f172a;
}

/* --- Base Reset & Typography --- */
html { font-size: 100%; }
* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; -webkit-tap-highlight-color: transparent; }

body { 
    background: linear-gradient(180deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%); 
    background-attachment: fixed; 
    min-height: 100vh; /* Fallback */
    min-height: 100dvh; /* Mobile fix */
    color: var(--text-primary); 
    overflow-x: hidden; 
}
/* --- Smooth Page Load Setup --- */
#app-container { 
    display: flex; 
    flex-direction: column; 
    min-height: 100vh; /* Fallback */
    min-height: 100dvh; /* Mobile fix */
    width: 100%; 
    opacity: 0; 
    transform: scale(0.98);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}
#app-container.page-loaded {
    opacity: 1;
    transform: scale(1);
}

/* --- Headers --- */
.app-header { height: var(--header-height-large); padding: 1.25rem; display: flex; flex-direction: column; justify-content: flex-end; color: white; }
.standard-header { height: var(--header-height-std); padding: 0 1.25rem; display: flex; align-items: center; justify-content: space-between; background: rgba(0, 0, 0, 0.1); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 50; color: white; }
.logo-placeholder { width: 2.5rem; height: 2.5rem; background: rgba(255,255,255,0.15); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 0.9rem; margin-bottom: 1rem; backdrop-filter: blur(0.3rem); border: 1px solid rgba(255,255,255,0.1); }
.header-text h1 { font-size: 1.1rem; font-weight: 400; color: var(--accent-gold); margin-bottom: 0.25rem; }
.header-text h2 { font-size: 1.8rem; font-weight: 700; letter-spacing: 0.03rem; }
.page-title { font-size: 1.2rem; font-weight: 600; position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; }
.back-btn { color: white; text-decoration: none; font-size: 1.5rem; width: 2.5rem; height: 2.5rem; display: flex; align-items: center; justify-content: flex-start; }
.home-btn { color: white; text-decoration: none; font-size: 1.5rem; width: 2.5rem; height: 2.5rem; display: flex; align-items: center; justify-content: flex-end; }

/* --- Content --- */
.content-area { flex: 1; padding: 1.25rem; padding-bottom: 2rem; animation: fadeIn 0.4s ease-out; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap-size); }
.text-content { background-color: var(--surface-color); padding: 1.5rem; border-radius: var(--border-radius); box-shadow: 0 0.25rem 1rem var(--shadow-color); line-height: 1.6; color: var(--text-primary); }
.text-content h3 { color: var(--accent-gold); margin-bottom: 1rem; font-size: 1.4rem; }
.text-content p { margin-bottom: 1rem; font-size: 1rem; color: var(--text-secondary); }

/* --- Tiles --- */
.tile { background-color: var(--surface-color); border-radius: var(--border-radius); padding: 1.25rem; min-height: 8.75rem; display: flex; flex-direction: column; justify-content: space-between; text-decoration: none; box-shadow: 0 0.25rem 0.9rem var(--shadow-color); transition: transform 0.1s ease, box-shadow 0.1s ease; border: 1px solid transparent; }
.tile:active { transform: scale(0.96); }
.icon-box { width: 2.8rem; height: 2.8rem; background-color: rgba(253, 185, 51, 0.15); border-radius: 0.75rem; color: var(--accent-gold); display: flex; align-items: center; justify-content: center; border: 1px solid rgba(253, 185, 51, 0.4); }
.icon-box img, .icon-box svg { width: 1.5rem; height: 1.5rem; display: block; }
.tile-label { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); line-height: 1.3; }

/* --- Simple Text Footer --- */
.simple-footer {
    text-align: center;
    padding: 2rem 1rem calc(1rem + env(safe-area-inset-bottom));
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: auto; /* Pushes footer to the bottom of the flex container */
}
.simple-footer a {
    color: var(--text-secondary);
    text-decoration: none;
    margin: 0 0.4rem;
    transition: color 0.2s;
}
.simple-footer a:hover {
    color: var(--primary-blue);
}
.footer-copyright {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    opacity: 0.7;
}

/* --- Form Styles --- */
.options-grid { display: flex; flex-direction: column; gap: 0.75rem; }
.option-btn { background-color: transparent; color: var(--text-primary); border: 1px solid var(--text-secondary); padding: 1rem; border-radius: 0.75rem; cursor: pointer; font-size: 0.95rem; text-align: left; transition: all 0.2s ease; font-weight: 500; opacity: 0.8; }
.option-btn:active { transform: scale(0.98); }
.option-btn.selected { background-color: rgba(253, 185, 51, 0.1); border-color: var(--accent-gold); color: var(--accent-gold); font-weight: 700; opacity: 1; }
.hidden { display: none !important; }
.form-input { width: 100%; padding: 0.875rem; border: 1px solid var(--input-border); border-radius: 0.75rem; background-color: var(--input-bg); color: var(--input-text); font-size: 1rem; transition: border-color 0.2s; }
.form-input:focus { outline: none; border-color: var(--accent-gold); }
.divider { border: 0; height: 1px; background: var(--input-border); margin: 1.5rem 0; opacity: 0.5; }
.credentials-form { display: flex; flex-direction: column; gap: 1rem; }
.section-label { font-weight: 600; margin-bottom: 0.5rem; font-size: 1rem; color: var(--text-primary); }
.input-group { display: flex; flex-direction: column; gap: 0.5rem; }
.input-group label { font-size: 0.85rem; color: var(--text-secondary); }
.action-btn { width: 100%; padding: 1rem; border: none; border-radius: 0.75rem; font-size: 1rem; cursor: pointer; font-weight: 600; margin-bottom: 0.75rem; transition: opacity 0.2s; }
.primary-btn { background-color: var(--primary-blue); color: white; }
.secondary-btn { background-color: transparent; color: var(--text-primary); border: 1px solid var(--text-secondary); }
.full-width { width: 100%; display: block; text-align: center; text-decoration: none; }
#status-message { text-align: center; font-size: 0.9rem; min-height: 1.5rem; font-weight: 600; margin-top: 0.5rem; }
.error { color: #ef4444; }
.success { color: #22c55e; }

/* --- Toggle Switch (Settings) --- */
.settings-row { display: flex; justify-content: space-between; align-items: center; padding: 1rem 0; border-bottom: 1px solid var(--input-border); }
.switch { position: relative; display: inline-block; width: 50px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--text-secondary); transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--accent-gold); }
input:checked + .slider:before { transform: translateX(22px); }

/* --- FCR Specific Styles --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-content { background: var(--surface-color); padding: 2rem; border-radius: var(--border-radius); width: 90%; max-width: 400px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); text-align: center; }
.modal-buttons { display: flex; gap: 1rem; margin-top: 1.5rem; }
.modal-buttons button { margin-bottom: 0; }
.glow-red { animation: pulse-red 2s infinite; border-color: #ef4444 !important; }
@keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); } 70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }
#fireworksCanvas { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 9999; }

/* --- Responsive --- */
@media (min-width: 768px) { 
    html { font-size: 110%; } 
    .dashboard-grid { grid-template-columns: repeat(3, 1fr); } 
    .app-header, .standard-header { padding: 1.5rem 2rem; } 
    .content-area { padding: 2rem; padding-bottom: 2rem; } 
}
@media (min-width: 1024px) { 
    .dashboard-grid { grid-template-columns: repeat(4, 1fr); } 
    .text-content { max-width: 800px; margin: 0 auto; } 
}

/* --- Animations --- */
@keyframes fadeIn { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: scale(1); } }
.slide-out-left { transform: translateX(-20%) !important; opacity: 0 !important; filter: blur(4px) !important; }
.slide-out-right { transform: translateX(20%) !important; opacity: 0 !important; filter: blur(4px) !important; }

/* --- Inline Validation Styles --- */
.required-star { color: #ef4444; margin-left: 0.25rem; font-weight: bold; }
.input-error { border-color: #ef4444 !important; box-shadow: 0 0 0 1px #ef4444; }
.error-msg { color: #ef4444; font-size: 0.85rem; margin-top: 0.35rem; }

/* --- Level 2 Specific Styles --- */
.blur-content { filter: blur(8px); pointer-events: none; user-select: none; transition: filter 0.3s ease; }
.lock-screen { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 9999; display: flex; align-items: center; justify-content: center; transition: opacity 0.3s ease; }
.lock-box { background: var(--surface-color); padding: 2rem; border-radius: var(--border-radius); text-align: center; width: 90%; max-width: 350px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.pin-input { font-size: 2rem; text-align: center; letter-spacing: 0.5rem; padding: 1rem; margin: 1rem 0; width: 100%; border: 2px solid var(--input-border); border-radius: 0.75rem; background: var(--input-bg); color: var(--text-primary); }
.pin-input:focus { border-color: var(--accent-gold); outline: none; }
.dynamic-row { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.dynamic-row input { flex: 1; }
.btn-remove { background: #ef4444; color: white; border: none; border-radius: 0.5rem; width: 3rem; font-weight: bold; cursor: pointer; }
.checkbox-group { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; color: var(--text-secondary); }
.checkbox-group input[type="checkbox"] { width: 1.2rem; height: 1.2rem; accent-color: var(--primary-blue); }

/* --- Hide Number Input Spinners --- */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}
.prev-btn {
    padding: 0.75rem;
    background-color: rgba(100, 116, 139, 0.15); /* Soft, transparent gray/blue */
    color: var(--text-secondary);
    border: none; /* Removed the border to make it distinct */
    font-size: 0.95rem;
    font-weight: 600;
}
.prev-btn:active {
    background-color: rgba(100, 116, 139, 0.25);
}
/* --- css/style.css --- */