/**
 * Age Calculator App Styles
 *
 * A production-ready age calculator with accessible, responsive design
 */

/* ========================================
   App Container
   ======================================== */

.app-container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

/* ========================================
   Age Calculator Container
   ======================================== */

.age-calculator {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    padding: var(--space-6);
}

/* ========================================
   Form Fields
   ======================================== */

.age-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.age-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.age-field label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text);
}

.age-field input[type="date"] {
    width: 100%;
    padding: var(--space-3);
    font-size: var(--font-size-base);
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.age-field input[type="date"]:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-alpha);
}

.age-field input[type="date"].error {
    border-color: var(--color-danger);
}

.age-field input[type="date"].error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.field-error {
    font-size: var(--font-size-xs);
    color: var(--color-danger);
    min-height: 1em;
}

/* Checkbox field */
.age-field-optional {
    margin-top: var(--space-2);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.checkbox-label:hover {
    color: var(--color-text);
}

/* Calculate at date field */
.age-field-calculate-at[hidden] {
    display: none;
}

/* ========================================
   Action Buttons
   ======================================== */

.age-buttons {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-2);
}

.age-btn {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    font-size: var(--font-size-base);
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.age-btn-primary {
    background: var(--color-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.age-btn-primary:hover {
    background: var(--color-primary-dark);
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.age-btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.age-btn-primary:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.age-btn-secondary {
    background: var(--color-bg-alt);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.age-btn-secondary:hover {
    background: var(--color-border);
}

.age-btn-secondary:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* ========================================
   Result Section
   ======================================== */

.age-result {
    margin-top: var(--space-6);
    padding-top: var(--space-6);
    border-top: 1px solid var(--color-border);
}

.age-result[hidden] {
    display: none;
}

/* Age Display */
.age-display {
    text-align: center;
    margin-bottom: var(--space-6);
}

.age-result-title {
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-4);
    color: var(--color-text-muted);
}

.age-values {
    display: flex;
    justify-content: center;
    gap: var(--space-4);
}

.age-value {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-4);
    background: var(--color-bg-alt);
    border-radius: var(--radius-lg);
    min-width: 80px;
}

.age-number {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--color-primary);
}

.age-label {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin-top: var(--space-1);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ========================================
   Birthday Section
   ======================================== */

.age-birthday {
    text-align: center;
    margin-bottom: var(--space-6);
    padding: var(--space-4);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
    border-radius: var(--radius-lg);
}

.age-birthday h3 {
    font-size: var(--font-size-base);
    color: var(--color-text);
    margin-bottom: var(--space-2);
}

.birthday-countdown {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-primary);
    margin: 0;
}

.birthday-countdown.happy-birthday {
    font-size: var(--font-size-xl);
    background: linear-gradient(135deg, #f59e0b, #ef4444, #ec4899, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========================================
   Statistics Section
   ======================================== */

.age-stats {
    background: var(--color-bg-alt);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
}

.age-stats h3 {
    font-size: var(--font-size-base);
    color: var(--color-text);
    margin-bottom: var(--space-4);
    text-align: center;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-3);
    background: var(--color-bg-card);
    border-radius: var(--radius-md);
    text-align: center;
}

.stat-value {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-text);
    word-break: break-word;
}

.stat-label {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-top: var(--space-1);
}

/* ========================================
   Use Cases Section
   ======================================== */

.use-cases {
    margin-top: var(--space-8);
    padding: var(--space-6);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}

.use-cases h2 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-3);
}

.use-cases-intro {
    color: var(--color-text-muted);
    margin-bottom: var(--space-4);
}

.use-cases-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: var(--space-4);
}

.use-cases-list li {
    padding: var(--space-4);
    background: var(--color-bg-alt);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--color-primary);
}

.use-cases-list strong {
    display: block;
    margin-bottom: var(--space-2);
    color: var(--color-text);
    font-weight: 600;
}

.use-cases-list p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 480px) {
    .age-calculator {
        padding: var(--space-4);
    }

    .age-values {
        gap: var(--space-2);
    }

    .age-value {
        padding: var(--space-3);
        min-width: 70px;
    }

    .age-number {
        font-size: 2rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .age-buttons {
        flex-direction: column;
    }
}

/* ========================================
   Help Panel
   ======================================== */

.help-panel {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.help-panel[hidden] {
    display: none;
}

.help-content {
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

.help-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    background: var(--color-bg-card);
}

.help-header h2 {
    font-size: var(--font-size-lg);
    margin: 0;
}

.help-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xl);
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
}

.help-close:hover {
    background: var(--color-bg-alt);
    color: var(--color-text);
}

.help-close:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.help-body {
    padding: var(--space-6);
}

.help-section {
    margin-bottom: var(--space-6);
}

.help-section:last-child {
    margin-bottom: 0;
}

.help-section h3 {
    font-size: var(--font-size-base);
    margin-bottom: var(--space-4);
    color: var(--color-text);
}

.help-steps {
    margin: 0;
    padding-left: var(--space-5);
}

.help-steps li {
    margin-bottom: var(--space-2);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

.help-features {
    margin: 0;
    padding-left: var(--space-5);
}

.help-features li {
    margin-bottom: var(--space-2);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

/* ========================================
   Header Actions
   ======================================== */

.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-text-muted);
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    cursor: pointer;
}

.btn-icon:hover {
    background: var(--color-border);
    color: var(--color-text);
}

.btn-icon:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .help-panel,
    .nav-actions {
        display: none;
    }

    .age-calculator {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
