/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-bg: #f8fafc;
    --color-text: #0f172a;
    --color-muted: #64748b;
    --color-border: #e2e8f0;
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --radius: 12px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
}

body {
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
    background-color: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    padding: 16px 0 12px;
    border-bottom: 1px solid var(--color-border);
}

header h1 {
    margin-bottom: 15px;
}

header h1 a {
    color: var(--color-text);
    text-decoration: none;
}

header h1 a:hover {
    color: var(--primary);
}

nav ul {
    display: flex;
    list-style: none;
    gap: 16px;
}

nav ul li {
    margin-right: 20px;
}

nav ul li a {
    color: var(--color-text);
    text-decoration: none;
    padding: 8px 10px;
    border-radius: 8px;
}

nav ul li a:hover {
    color: var(--primary);
    background-color: rgba(37, 99, 235, 0.06);
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown-toggle::after {
    content: "\25BE"; /* down arrow */
    margin-left: 6px;
    font-size: 0.8em;
    color: var(--color-muted);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    padding: 8px;
    display: none;
    z-index: 20;
}

.dropdown-menu.open {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--color-text);
    text-decoration: none;
}

.dropdown-menu a:hover {
    background-color: rgba(37, 99, 235, 0.06);
    color: var(--primary);
}

@media screen and (max-width: 768px) {
    .dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        padding: 0;
    }
}

/* Main Content */
main {
    flex: 1;
    padding: 24px 0;
}

/* Footer */
footer {
    padding: 20px 0;
    border-top: 1px solid var(--color-border);
    text-align: center;
    margin-top: auto;
    color: var(--color-muted);
}

footer a {
    color: var(--primary);
    text-decoration: none;
}

/* Home Page */
.hero {
    text-align: center;
    padding: 40px 0;
}

/* Ensure hero description centered and nicely spaced */
.hero p {
    text-align: center;
    margin: 0 auto 12px;
}

.hero h2 {
    font-size: 2.2rem;
    margin-bottom: 12px;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.tool-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    background: #fff;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.tool-card h3 {
    margin-bottom: 10px;
}

.tool-card p {
    margin-bottom: 15px;
    color: var(--color-muted);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

input[type="text"],
input[type="email"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

textarea {
    resize: vertical;
}

.button {
    display: inline-block;
    background-color: var(--primary);
    color: #fff;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    font-size: 16px;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.button:hover {
    background-color: var(--primary-dark);
}

/* Responsive Navigation (moved from inline style) */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 20px;
}

.nav-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--color-text);
    margin: 5px 0;
    transition: all 0.3s ease;
}

@media screen and (max-width: 768px) {
    header {
        position: relative;
        padding-top: 10px;
    }

    .nav-toggle {
        display: block;
    }

    nav {
        display: none;
        width: 100%;
        padding: 10px 0;
    }

    nav.active {
        display: block;
    }

    nav ul {
        flex-direction: column;
        padding: 0;
        margin: 0;
    }

    nav ul li {
        width: 100%;
        text-align: center;
        padding: 10px 0;
        border-bottom: 1px solid var(--color-border);
    }

    nav ul li:last-child {
        border-bottom: none;
    }

    .nav-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .nav-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }

    .container {
        padding: 10px;
    }

    header h1 {
        text-align: center;
        margin-right: 50px;
    }
}

/* Results */
.result {
    margin-top: 30px;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 4px;
}

.result h3 {
    margin-bottom: 15px;
}

.result-text {
    width: 100%;
    background-color: #fff;
    border: 1px solid #ddd;
    padding: 10px;
}

/* Radio Player */
.radio-player {
    max-width: 600px;
    margin: 0 auto;
}

#current-station {
    text-align: center;
    margin: 15px 0;
    font-weight: bold;
}

audio {
    width: 100%;
    margin: 15px 0;
}

.volume-control {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.volume-control label {
    margin-right: 10px;
    margin-bottom: 0;
    min-width: 70px;
}

.sleep-timer {
    margin-top: 20px;
}

#cooldown-timer {
    margin-top: 10px;
    color: #dc3545;
    font-weight: bold;
}

/* Alert Messages */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Error Page */
.error-page {
    text-align: center;
    padding: 50px 0;
}

.error-page h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.error-page p {
    margin-bottom: 30px;
    font-size: 1.2rem;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .tools-grid {
        grid-template-columns: 1fr;
    }
    
    nav ul {
        flex-direction: column;
    }
    
    nav ul li {
        margin-right: 0;
        margin-bottom: 10px;
    }
}

/* Typography & Readability (global) */
main h2 {
    font-size: 2rem;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--color-text);
    margin-bottom: 12px;
}

main h3 {
    font-size: 1.25rem;
    line-height: 1.35;
    color: var(--color-text);
    margin-top: 16px;
    margin-bottom: 8px;
}

main h4 {
    font-size: 1.1rem;
    line-height: 1.35;
    color: var(--color-text);
    margin-top: 14px;
    margin-bottom: 6px;
}

main p {
    font-size: 0.975rem;
    line-height: 1.7;
    color: var(--color-muted);
    max-width: 75ch;
    margin-bottom: 12px;
}

main ul,
main ol {
    padding-left: 1.25rem;
    margin: 10px 0 16px;
}

main li {
    margin-bottom: 6px;
    color: var(--color-text);
}

.note {
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    color: var(--color-muted);
}

/* Inputs & Textareas readability */
input[type="text"],
input[type="email"],
input[type="number"],
textarea,
select {
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
    min-height: 140px;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}