/* SECTION: Global Styles - Defines variables and base styles for the webpage */
/*
 * Purpose: Sets up **CSS variables** and **base styles** for consistent design.
 * - Provides **color**, **spacing**, and **shadow** variables for reusability.
 * - Applies **body** styling for centered layout and font.
 * - Ensures **responsive** design with flexible container sizing.
 */

/* Purpose: Define CSS variables */
:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #d1d5db;
    --secondary-hover: #9ca3af;
    --background-color: #f3f4f6;
    --card-background: #f9fafb;
    --text-color: #374151;
    --error-color: #ef4444;
    --warning-color: #eab308;
    --loading-color: #6b7280;
    --highlight-color: #2563eb;
    --disabled-color: #e5e7eb;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --border-color: #d1d5db;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --border-radius: 0.25rem;
    --border-radius-lg: 0.5rem;
}

/* Purpose: Base body styling */
body {
    background-color: var(--background-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    font-family: system-ui, sans-serif;
    color: var(--text-color);
}

/* SECTION: Container - Styles the main UI container */
/*
 * Purpose: Styles the **main container** for the syllable counter UI.
 * - Creates a **centered**, **shadowed** card with **white background**.
 * - Limits **width** for readability and responsiveness.
 * - Applies **padding** for internal spacing.
 */
.container {
    /* Purpose: Layout and appearance */
    background-color: white;
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 28rem;
    width: 100%;
}

/* SECTION: Typography - Styles for headings */
/*
 * Purpose: Defines **heading** styles for the page title.
 * - Applies **bold** font and **centered** alignment for main title.
 * - Uses **large font size** for prominence.
 * - Adds **margin** and **padding** for spacing.
 */
h1 {
    /* Purpose: Typography */
    font-size: 30px; /* Sets font size for prominent titles */
    text-shadow: 4px 4px 6px gray; /* Adds a gray shadow for depth */
    text-align: center;
    
    /* Purpose: Layout */
    display: block; /* Ensures h1 behaves as a block element, taking full width */
    
    /* Purpose: Spacing and Shape */
    padding: 10px 20px; /* Applies padding for internal spacing */
    
    /* Purpose: Positioning */
    margin-bottom: var(--spacing-md); /* Adds space below to separate from following content */
}

/* SECTION: Input Group - Styles for input field and clear button */
/*
 * Purpose: Styles the **input field** and **clear button** group.
 * - Uses **flexbox** for horizontal layout with **gap**.
 * - Ensures **responsive** input sizing.
 * - Applies **margin** for spacing below.
 */
.input-group {
    /* Purpose: Layout */
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

/* Purpose: Input field styling */
input {
    /* Purpose: Layout and appearance */
    flex-grow: 1;
    padding: var(--spacing-sm);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

/* Purpose: Input focus state */
input:focus {
    /* Purpose: Interaction */
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

/* SECTION: Checkbox Group - Styles for display option checkboxes */
/*
 * Purpose: Styles the **checkbox group** for toggling display of audio, definition, and spellings.
 * - Uses **flexbox** for horizontal or vertical layout based on screen size.
 * - Applies **consistent spacing** and **label styling** for readability.
 * - Ensures **accessibility** with clear focus states and cursor interaction.
 */
.checkbox-group {
    /* Purpose: Layout */
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    margin: var(--spacing-md) 0;
    justify-content: center;
}

.checkbox-group label {
    /* Purpose: Label appearance */
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.9rem;
    color: var(--text-color);
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    /* Purpose: Checkbox appearance */
    accent-color: var(--primary-color);
    width: 1rem;
    height: 1rem;
}

.checkbox-group input[type="checkbox"]:focus {
    /* Purpose: Checkbox focus state */
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

/* SECTION: Buttons - Styles for primary, secondary, and audio buttons */
/*
 * Purpose: Defines **button** styles for submit, clear, and audio actions.
 * - Provides **reusable** base styles for all buttons.
 * - Applies **primary**, **secondary**, and **audio** variants with **hover** and **disabled** states.
 * - Ensures **accessible** cursor and focus states.
 */
.btn {
    /* Purpose: Base button styles */
    padding: var(--spacing-sm);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    text-align: center;
    font-size: 0.9rem;
}

.btn-primary {
    /* Purpose: Primary button appearance */
    background-color: var(--primary-color);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    /* Purpose: Primary button hover state */
    background-color: var(--primary-hover);
}

.btn-secondary {
    /* Purpose: Secondary button appearance */
    background-color: var(--secondary-color);
    color: var(--text-color);
}

.btn-secondary:hover {
    /* Purpose: Secondary button hover state */
    background-color: var(--secondary-hover);
}

.btn-audio {
    /* Purpose: Audio button appearance */
    background-color: #10b981;
    color: white;
    padding: 0.25rem 0.5rem;
    margin-left: var(--spacing-sm);
}

.btn-audio:hover {
    /* Purpose: Audio button hover state */
    background-color: #059669;
}

.btn-audio.disabled {
    /* Purpose: Disabled audio button appearance */
    background-color: var(--disabled-color);
    cursor: not-allowed;
}

/* SECTION: Result - Styles for result display area */
/*
 * Purpose: Styles the **result display** for syllable, pronunciation, definition, and spelling output.
 * - Centers **content** for readability.
 * - Applies **margin** for spacing.
 * - Supports **card**, **audio button**, **error/warning**, **definition**, and **spelling** displays.
 */
.result {
    /* Purpose: Layout */
    margin-top: var(--spacing-md);
    text-align: center;
}

.card {
    /* Purpose: Card appearance */
    background-color: var(--card-background);
    padding: var(--spacing-md);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
}

.card p {
    /* Purpose: Card content spacing */
    margin: var(--spacing-sm) 0;
}

.definition {
    /* Purpose: Definition text appearance */
    font-style: italic;
    color: var(--text-color);
    text-align: left;
}

.spellings {
    /* Purpose: Spelling text appearance */
    color: var(--text-color);
    text-align: left;
}

/* SECTION: Footer - Styles for version information */
/*
 * Purpose: Styles the **footer** displaying application version.
 * - Centers **text** for readability.
 * - Applies **subtle** color and **small font** for minimal prominence.
 * - Adds **margin** for spacing from main content.
 */
.footer {
    /* Purpose: Layout and appearance */
    text-align: center;
    color: var(--loading-color);
    font-size: 0.8rem;
    margin-top: var(--spacing-lg);
    padding: var(--spacing-sm);
}

/* SECTION: States - Styles for highlights, errors, warnings, and loading */
/*
 * Purpose: Defines **state-specific** styles for UI feedback.
 * - Highlights **syllables** with bold and color.
 * - Styles **error** and **warning** messages for visibility.
 * - Controls **loading** indicator visibility.
 */
.highlight {
    /* Purpose: Syllable highlighting */
    font-weight: bold;
    color: var(--highlight-color);
}

.error {
    /* Purpose: Error message appearance */
    color: var(--error-color);
}

.warning {
    /* Purpose: Warning message appearance */
    color: var(--warning-color);
    margin-top: var(--spacing-sm);
}

.loading {
    /* Purpose: Loading indicator appearance */
    margin-top: var(--spacing-sm);
    color: var(--loading-color);
    display: none;
}

.loading.active {
    /* Purpose: Loading indicator visibility */
    display: block;
}