/* ==========================================================================
   1. GLOBAL RESET & VARIABLES
   ========================================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    scrollbar-gutter: stable;
}

:root {
    --primary: #1f3a4d;
    --accent: #1f78d1;

    --bg: #eef3f7;
    --text: #1f2933;

    --container-bg: #ffffff;
    --card-bg: #ffffff;

    --border-color: #d7e0e8;
    --item-bg: #f6f9fc;
    --selected-bg: #dbeeff;

    --shadow-sm: 0 4px 20px rgba(16, 24, 40, 0.08);
    --shadow-hover: 0 8px 20px rgba(16, 24, 40, 0.12);
    --focus-ring: 0 0 0 3px rgba(31, 120, 209, 0.22);

    --muted-text: #5f6c7a;
    --input-bg: #ffffff;
    --btn-bg: #f6f9fc;
    --btn-hover-bg: #eaf4ff;
    --check-border: #dfe6ed;
}

html.dark-mode {
    --primary: #ecf0f1;
    --accent: #3498db;

    --bg: #1a1a1a;
    --text: #e0e0e0;

    --container-bg: #2d2d2d;
    --card-bg: #3d3d3d;

    --border-color: #444;
    --item-bg: #333;
    --selected-bg: #34495e;

    --shadow-sm: 0 4px 20px rgba(0, 0, 0, 0.28);
    --shadow-hover: 0 8px 20px rgba(0, 0, 0, 0.32);
    --focus-ring: 0 0 0 3px rgba(52, 152, 219, 0.22);

    --muted-text: #aeb7c0;
    --input-bg: #3d3d3d;
    --btn-bg: #3d3d3d;
    --btn-hover-bg: #444;
    --check-border: #444;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    font-family: "Segoe UI", system-ui, sans-serif;
    line-height: 1.6;
    background-color: var(--bg);
    color: var(--text);
}

/* ==========================================================================
   2. LAYOUT & CONTAINERS
   ========================================================================== */
.container {
    width: 95%;
    max-width: 900px;
    min-height: 600px;
    margin: 40px auto;
    padding: 40px;
    background: var(--container-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.home-hero {
    padding: 20px 0;
    margin-bottom: 30px;
    text-align: center;
}

.home-hero h1 {
    margin-bottom: 10px;
}

.home-hero p {
    margin-top: 0;
}

.home-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

@media (min-width: 768px) {
    .home-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .container {
        min-height: auto;
        margin: 15px auto;
        padding: 25px 15px;
    }
}

/* ==========================================================================
   3. COMPONENTS (CARDS & BUTTONS)
   ========================================================================== */
.tool-card,
.btn,
.footer-btn {
    border-radius: 12px;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
}

/* Focus states */
.btn:focus-visible,
.footer-btn:focus-visible,
input[type="number"]:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.btn:focus:not(:focus-visible),
.footer-btn:focus:not(:focus-visible),
input[type="number"]:focus:not(:focus-visible) {
    outline: none;
}

/* Hover only where hover actually exists */
@media (hover: hover) {
    .tool-card:hover,
    .btn:hover:not(:disabled):not(.is-selected),
    .footer-btn:hover:not(.is-selected) {
        transform: translateY(-2px);
        box-shadow: var(--shadow-hover);
    }

    .btn:hover:not(:disabled):not(.is-selected):not(.btn-primary):not(.btn-exit):not(.btn-back) {
        background: var(--btn-hover-bg);
        border-color: var(--accent);
    }

    .btn.btn-primary:hover:not(:disabled):not(.is-selected) {
        background: #2a6fa8;
    }

    .btn.btn-exit:hover:not(:disabled):not(.is-selected),
    .btn.btn-back:hover:not(:disabled):not(.is-selected) {
        background: #cf4b3d;
    }

    .theme-green .btn.btn-primary:hover:not(:disabled):not(.is-selected) {
        background: #2d9b63;
    }

    .theme-blue .btn.btn-primary:hover:not(:disabled):not(.is-selected) {
        background: #2f86cf;
    }

    .theme-pink .btn.btn-primary:hover:not(:disabled):not(.is-selected) {
        background: #cf3f78;
    }

    .theme-orange .btn.btn-primary:hover:not(:disabled):not(.is-selected) {
        background: #dc9a2f;
    }

    .theme-purple .btn.btn-primary:hover:not(:disabled):not(.is-selected) {
        background: #8d63ba;
    }
   .theme-teal .btn.btn-primary:hover:not(:disabled):not(.is-selected) {
    background: #006f6f;
}
}

/* Selected state */
.btn.is-selected {
    background: var(--selected-bg);
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
    transform: none;
}

/* Tool cards */
.tool-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 25px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-left: 5px solid var(--accent);
}

.tool-card h2,
.tool-card h3 {
    margin: 0 0 10px;
    font-size: 1.4rem;
    color: var(--accent);
}

.tool-card p {
    flex-grow: 1;
    margin: 0 0 20px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.tool-card .btn {
    margin-top: auto;
}

/* Standard buttons */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 52px;
    margin: 12px 0;
    padding: 16px;
    border: 1px solid var(--border-color);
    background: var(--btn-bg);
    color: var(--text);
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
}

/* Disabled state */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Button variants */
.btn-primary {
    background: var(--accent);
    color: #fff;
    border: none;
}

.btn-exit,
.btn-back {
    margin-top: 20px;
    background: #e74c3c;
    color: #fff;
    border: none;
}

html.dark-mode .btn-exit,
html.dark-mode .btn-back {
    background: #c0392b;
    color: #f8d7da;
}
.theme-teal {
    border-left-color: #008080;
}

.theme-teal h2,
.theme-teal h3 {
    color: #008080;
}

.theme-teal .btn-primary {
    background: #008080;
}

/* Footer pill buttons */
.footer-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 25px;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    background: var(--item-bg);
    color: var(--text);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
}

/* ==========================================================================
   4. INFO / NOTIFICATION BOXES
   ========================================================================== */
.alert-box,
.caution-box,
.disclaimer-banner,
.result-box,
.privacy-disclaimer {
    margin: 20px auto;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-left-width: 6px;
    border-radius: 12px;
    color: var(--text);
}

.alert-box {
    background: rgba(231, 76, 60, 0.05);
    border-color: #e74c3c;
}

.caution-box {
    background: rgba(243, 156, 18, 0.08);
    border-color: #f39c12;
}

.disclaimer-banner {
    max-width: 90%;
    background: rgba(0, 128, 128, 0.05);
    border-color: #008080;
}

.result-box {
    border-left-color: var(--accent);
}

.privacy-disclaimer {
    max-width: 750px;
    text-align: center;
    background-color: rgba(128, 128, 128, 0.05);
    border-left-width: 1px;
}

/* Typography inside boxes */
.alert-box strong,
.caution-box strong,
.disclaimer-banner strong,
.privacy-disclaimer strong {
    display: inline-block;
    margin-bottom: 4px;
    font-size: 1rem;
}

.alert-box strong {
    color: #c0392b;
}

.caution-box strong {
    color: #f39c12;
}

.disclaimer-banner strong,
.privacy-disclaimer strong {
    color: #008080;
}

/* Checklist items */
.check-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding: 14px;
    background: var(--item-bg);
    border: 1px solid var(--check-border);
    border-left: 4px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
}

/* ==========================================================================
   5. FORM ELEMENTS
   ========================================================================== */
input[type="number"] {
    width: 100%;
    max-width: 120px;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text);
    font-size: 1rem;
}

input[type="number"]:focus-visible {
    border-color: var(--accent);
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

input[type="number"] {
    -moz-appearance: textfield;
}

.hidden {
    display: none;
}

/* ==========================================================================
   6. ANIMATIONS
   ========================================================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container > div:not(.hidden) {
    animation: fadeIn 0.4s ease-out;
}

/* Theme transition helper */
html.theme-transition,
html.theme-transition .container,
html.theme-transition .tool-card,
html.theme-transition .btn,
html.theme-transition .footer-btn,
html.theme-transition .alert-box,
html.theme-transition .caution-box,
html.theme-transition .disclaimer-banner,
html.theme-transition .result-box,
html.theme-transition .privacy-disclaimer,
html.theme-transition .check-item,
html.theme-transition input {
    transition:
        background-color 0.3s ease,
        color 0.3s ease,
        border-color 0.3s ease,
        box-shadow 0.3s ease;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================================================
   7. INDEX PAGE SPECIFIC THEMES & FOOTER
   ========================================================================== */
.site-footer {
    margin-top: 50px;
    padding: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--muted-text);
    font-size: 0.75rem;
    text-align: center;
}

.version-text {
    margin-top: 20px;
    color: var(--muted-text);
    font-size: 0.8rem;
    text-align: center;
}

/* Theme variants */
.theme-green {
    border-left-color: #27ae60;
}

.theme-green h2,
.theme-green h3 {
    color: #27ae60;
}

.theme-green .btn-primary {
    background: #27ae60;
}

.theme-blue {
    border-left-color: #3498db;
}

.theme-blue h2,
.theme-blue h3 {
    color: #3498db;
}

.theme-blue .btn-primary {
    background: #3498db;
}

.theme-pink {
    border-left-color: #e91e63;
}

.theme-pink h2,
.theme-pink h3 {
    color: #e91e63;
}

.theme-pink .btn-primary {
    background: #e91e63;
}

.theme-orange {
    border-left-color: #f39c12;
}

.theme-orange h2,
.theme-orange h3 {
    color: #f39c12;
}

.theme-orange .btn-primary {
    background: #f39c12;
}

.theme-purple {
    border-left-color: #9b59b6;
}

.theme-purple h2,
.theme-purple h3 {
    color: #9b59b6;
}

.theme-purple .btn-primary {
    background: #9b59b6;
}

.footer-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
}
