/* =========================================
   1. CSS VARIABLES & THEMING SYSTEM
   ========================================= */
:root {
    /* --- DEFAULT (GLASS THEME) VARIABLES --- */
    --bg-gradient: linear-gradient(135deg, #1c92d2 0%, #f2fcfe 100%);
    --container-bg: rgba(255, 255, 255, 0.85);
    --container-border: 1px solid rgba(255, 255, 255, 0.5);
    --container-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --text-main: #333;
    --text-secondary: #555;
    --header-color: #004e80;
    --btn-bg: #ffffff;
    --btn-text: #333;
    --btn-border: 1px solid rgba(0,0,0,0.05);
    --btn-radius: 50px;
    --btn-hover-transform: translateY(-3px) scale(1.02);
    --btn-hover-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    --btn-hover-color: #0077b6;
    --search-bg: rgba(255,255,255,0.9);
    --search-border: 2px solid rgba(255,255,255,0.8);
    --controls-bg: rgba(255, 255, 255, 0.9);
    --controls-text: #444;
    --modal-bg: #ffffff;
    --modal-overlay: rgba(0,0,0,0.5);
}

/* --- DARK MODE OVERRIDES (Applies to all themes unless specific) --- */
body.dark-mode {
    --text-main: #f0f0f0;
    --text-secondary: #ccc;
    --header-color: #64b5f6;
    --controls-bg: #2d3748;
    --controls-text: #fff;
    --modal-bg: #2d3748;
    --modal-overlay: rgba(0,0,0,0.7);
}

/* --- THEME 1: GLASS OCEAN (Dark Mode adjustments) --- */
body[data-theme="glass"].dark-mode {
    --bg-gradient: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    --container-bg: rgba(30, 41, 59, 0.7); /* Dark glass */
    --container-border: 1px solid rgba(255, 255, 255, 0.1);
    --btn-bg: rgba(255, 255, 255, 0.1);
    --btn-text: #fff;
    --btn-border: 1px solid rgba(255, 255, 255, 0.1);
    --btn-hover-color: #81d4fa;
    --search-bg: rgba(0,0,0,0.3);
    --search-border: 2px solid rgba(255,255,255,0.1);
}

/* --- THEME 2: TACTICAL OPS (High Contrast / Industrial) --- */
body[data-theme="tactical"] {
    --bg-gradient: #e5e5e5; /* Industrial Grey */
    --container-bg: #ffffff;
    --container-border: 2px solid #000;
    --container-shadow: 8px 8px 0px rgba(0,0,0,1); /* Hard shadow */
    --text-main: #000;
    --text-secondary: #333;
    --header-color: #000;
    --btn-bg: #fff;
    --btn-text: #000;
    --btn-border: 2px solid #000;
    --btn-radius: 4px; /* Square corners */
    --btn-hover-transform: translate(-2px, -2px);
    --btn-hover-shadow: 4px 4px 0px #000; /* Pop-out effect */
    --btn-hover-color: #000;
    --search-bg: #fff;
    --search-border: 2px solid #000;
    --controls-bg: #fff;
    --controls-text: #000;
    --modal-bg: #fff;
}

body[data-theme="tactical"].dark-mode {
    --bg-gradient: #1a1a1a;
    --container-bg: #2d2d2d;
    --container-border: 2px solid #fbbf24; /* Caution Yellow border */
    --container-shadow: 6px 6px 0px #fbbf24;
    --text-main: #fbbf24; /* Yellow text */
    --text-secondary: #fff;
    --header-color: #fbbf24;
    --btn-bg: #1a1a1a;
    --btn-text: #fff;
    --btn-border: 2px solid #fbbf24;
    --btn-hover-shadow: 4px 4px 0px #fbbf24;
    --btn-hover-color: #fbbf24;
    --search-bg: #000;
    --search-border: 2px solid #fbbf24;
    --controls-bg: #333;
    --controls-text: #fbbf24;
    --modal-bg: #2d2d2d;
}

/* --- THEME 3: SWISS MINIMAL (Clean / Corporate) --- */
body[data-theme="minimal"] {
    --bg-gradient: #f4f4f5; /* Off-white */
    --container-bg: #ffffff;
    --container-border: 1px solid #e4e4e7;
    --container-shadow: 0 1px 3px rgba(0,0,0,0.05);
    --text-main: #18181b;
    --text-secondary: #52525b;
    --header-color: #18181b;
    --btn-bg: #f4f4f5;
    --btn-text: #18181b;
    --btn-border: 1px solid transparent;
    --btn-radius: 12px;
    --btn-hover-transform: translateY(-1px);
    --btn-hover-shadow: none;
    --btn-hover-color: #000;
    --search-bg: #fff;
    --search-border: 1px solid #e4e4e7;
}

body[data-theme="minimal"].dark-mode {
    --bg-gradient: #09090b; /* Almost black */
    --container-bg: #18181b;
    --container-border: 1px solid #27272a;
    --container-shadow: none;
    --text-main: #fff;
    --text-secondary: #a1a1aa;
    --header-color: #fff;
    --btn-bg: #27272a;
    --btn-text: #fff;
    --btn-border: 1px solid #3f3f46;
    --btn-hover-color: #fff;
    --search-bg: #18181b;
    --search-border: 1px solid #3f3f46;
}


/* --- THEME 4: RAPID RESPONSE (Bright / Mobile-first / Civic) --- */
body[data-theme="rapid"] {
    --bg-gradient: #eaf4fa;
    --container-bg: #ffffff;
    --container-border: 1px solid #d4e2e9;
    --container-shadow: 0 8px 26px rgba(7, 68, 100, 0.13);
    --text-main: #102d3d;
    --text-secondary: #527181;
    --header-color: #086c9f;
    --btn-bg: #ffffff;
    --btn-text: #102d3d;
    --btn-border: 1px solid #d4e2e9;
    --btn-radius: 9px;
    --btn-hover-transform: translateY(-2px);
    --btn-hover-shadow: 0 8px 20px rgba(8, 108, 159, 0.18);
    --btn-hover-color: #086c9f;
    --search-bg: #ffffff;
    --search-border: 1px solid #d4e2e9;
    --controls-bg: #ffffff;
    --controls-text: #102d3d;
    --modal-bg: #ffffff;
    --modal-overlay: rgba(16, 45, 61, 0.45);
}

body[data-theme="rapid"].dark-mode {
    --bg-gradient: #0b2233;
    --container-bg: #123043;
    --container-border: 1px solid #1e4a63;
    --container-shadow: 0 8px 26px rgba(0, 0, 0, 0.35);
    --text-main: #eaf4fa;
    --text-secondary: #9db8c7;
    --header-color: #7cc7ea;
    --btn-bg: #1a3a52;
    --btn-text: #eaf4fa;
    --btn-border: 1px solid #2a5a78;
    --btn-hover-color: #7cc7ea;
    --search-bg: #0e2a3f;
    --search-border: 1px solid #2a5a78;
    --controls-bg: #123043;
    --controls-text: #eaf4fa;
    --modal-bg: #123043;
    --modal-overlay: rgba(0, 0, 0, 0.6);
}


/* =========================================
   2. CORE STYLES
   ========================================= */
* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: var(--bg-gradient);
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-main);
    transition: background 0.3s ease, color 0.3s ease;
}

/* --- VIEW CONTROLS (Floating Bar) --- */
.view-controls {
    position: fixed;
    bottom: 30px; /* Moved to bottom */
    left: 50%;    /* Center horizontally */
    transform: translateX(-50%); /* Center alignment */
    top: auto;    /* Remove top positioning */
    right: auto;  /* Remove right positioning */
    
    background: var(--controls-bg);
    color: var(--controls-text);
    padding: 12px 25px;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    z-index: 1000;
    font-size: 14px;
    font-weight: 600;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    width: max-content;
    max-width: 95%; /* Prevent overflow on small screens */
}

/* Select Dropdown Styling */
.theme-select {
    padding: 5px 10px;
    border-radius: 20px;
    border: 1px solid #ccc;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    background: rgba(255,255,255,0.8);
    color: #333;
}

/* Icons Buttons (Toggle & Share) */
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s;
    color: var(--controls-text);
}
.icon-btn:hover { transform: scale(1.15); }

/* View Switch (Slider) */
.switch-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 16px; width: 16px;
    left: 3px; bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider { background-color: #0077b6; }
input:checked + .slider:before { transform: translateX(18px); }


/* --- MAIN CONTAINER --- */
.container {
    width: 100%;
    max-width: 900px; 
    padding: 40px 30px;
    margin-top: 20px; /* Reduced top margin since controls moved down */
    padding-bottom: 120px; /* Extra padding at bottom so controls don't cover footer */
    text-align: center;
    
    /* Theming applied here */
    background: var(--container-bg);
    border: var(--container-border);
    box-shadow: var(--container-shadow);
    border-radius: 30px;
    backdrop-filter: blur(10px); /* For glass effect */

    animation: fadeIn 0.6s ease-out;
    transition: all 0.4s ease;
}

/* Mobile Mode Modifier */
.container.mobile-mode {
    max-width: 400px;
    margin-top: 40px;
    margin-bottom: 100px;
    padding: 40px 20px;
    border-radius: 40px;
}

/* --- PROFILE --- */
.profile-img {
    width: 110px; height: 110px;
    border-radius: 50%; 
    background-color: #fff;
    margin: 0 auto 20px;
    display: block;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    object-fit: contain; 
    padding: 8px;
    border: 2px solid rgba(0,0,0,0.05);
}

.profile-title {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.profile-bio {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 30px;
    line-height: 1.5;
}

/* --- SEARCH BAR --- */
.search-container {
    width: 100%;
    margin-bottom: 25px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 16px 20px;
    padding-left: 50px;
    border-radius: 50px;
    border: var(--search-border);
    background: var(--search-bg);
    color: var(--text-main);
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.search-input:focus {
    box-shadow: 0 6px 15px rgba(0,0,0,0.1);
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: var(--text-secondary);
    pointer-events: none;
}

/* --- LINK LIST --- */
.link-list {
    display: flex;
    flex-direction: column;
    gap: 14px; 
    text-align: left; 
}

.section-header {
    color: var(--header-color);
    font-size: 0.95rem;
    font-weight: 800;
    margin: 20px 0 5px 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.8;
}

/* --- BUTTONS --- */
.link-btn {
    display: block;
    width: 100%;
    background-color: var(--btn-bg);
    color: var(--btn-text);
    text-decoration: none;
    padding: 18px 24px;
    border-radius: var(--btn-radius);
    border: var(--btn-border);
    font-weight: 600;
    font-size: 16px;
    text-align: center;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
}

.link-btn:hover {
    transform: var(--btn-hover-transform);
    box-shadow: var(--btn-hover-shadow);
    color: var(--btn-hover-color);
    background: var(--btn-bg); /* Ensure background stays solid */
    filter: brightness(1.02); /* Slight brightness boost */
}

.link-btn:active {
    transform: scale(0.98);
}

.hidden-item { display: none !important; }

/* --- FOOTER --- */
footer {
    margin-top: 40px;
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.7;
    text-align: center;
}

/* --- MODAL (POPUPS) STYLES --- */
.modal {
    display: none; 
    position: fixed; 
    z-index: 2000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: var(--modal-overlay); 
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: var(--modal-bg);
    margin: 15% auto; 
    padding: 25px; 
    border: 1px solid rgba(255,255,255,0.1); 
    width: 90%; 
    max-width: 400px;
    border-radius: 20px;
    text-align: center;
    color: var(--text-main);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    position: relative;
}

.close-modal {
    color: #aaa;
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover { color: var(--text-main); }

.share-title { margin-top: 0; font-size: 20px; font-weight: 700; }
.share-text { font-size: 14px; color: var(--text-secondary); margin-bottom: 20px; }

/* Bookmark Instructions Style */
.bookmark-instructions {
    text-align: left;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}
.bookmark-instructions p { margin-bottom: 15px; }
.bookmark-instructions strong { color: var(--text-main); }

/* Copy Styles */
.copy-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.share-input-field {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #ccc;
    background: rgba(0,0,0,0.05);
    color: var(--text-main);
    font-family: monospace;
}

.copy-btn {
    padding: 12px 20px;
    background: #0077b6;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
}

.copy-btn:hover { background: #005f91; }

.copy-message {
    display: none;
    color: #28a745;
    margin-top: 10px;
    font-size: 13px;
    font-weight: 600;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }

}

/* =========================================
   3. FORM & CALCULATOR STYLES
   ========================================= */

.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.std-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.1);
    background: var(--btn-bg);
    color: var(--text-main);
    font-size: 18px;
    font-family: inherit;
    transition: all 0.3s ease;
}
.std-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--header-color);
}

/* Radio Button Styling */
.radio-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.radio-input {
    display: none; /* Hide default radio */
}

.radio-label {
    flex: 1;
    padding: 15px;
    background: var(--btn-bg);
    border: var(--btn-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0.7;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Highlight selected radio */
.radio-input:checked + .radio-label {
    opacity: 1;
    background: var(--header-color);
    color: #fff; /* Force white text on active selection */
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Results Grid */
.card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 20px;
}

.info-card {
    background: var(--btn-bg);
    padding: 15px;
    border-radius: 16px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    border: var(--btn-border);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
/* v14: NEW badges + What's New modal */
.new-badge{display:inline-block;background:#d92525;color:#fff;font-size:10px;font-weight:800;padding:3px 10px;border-radius:999px;margin-left:10px;letter-spacing:.6px;vertical-align:middle;}
.wn-overlay{position:fixed;inset:0;background:rgba(0,0,0,.55);display:flex;align-items:center;justify-content:center;z-index:9999;padding:20px;}
.wn-box{background:#fff;color:#1c2b36;border:1px solid #ccc;border-radius:16px;padding:24px;max-width:420px;width:100%;}
.wn-title{font-size:24px;font-weight:800;margin-bottom:10px;}
.wn-list{font-size:14px;line-height:1.65;padding-left:20px;margin:0 0 6px;}
