/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* Main Container */
.age-calculator-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.calculator-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 0 20px;
}

.calculator-header h1 {
    font-size: 2.8rem;
    color: #2c3e50;
    margin-bottom: 12px;
    font-weight: 700;
    line-height: 1.2;
}

.subtitle {
    font-size: 1.2rem;
    color: #5d6d7e;
    font-weight: 400;
    max-width: 600px;
    margin: 0 auto;
}

/* Calculator Wrapper */
.calculator-wrapper {
    width: 100%;
}

/* Calculator Card */
.calculator-card {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 40px;
}

/* Input Section */
.input-section {
    padding: 40px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.input-group {
    margin-bottom: 30px;
}

.input-label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 1.1rem;
}

.required-asterisk {
    color: #dc3545;
    margin-left: 4px;
}

.date-input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #dee2e6;
    border-radius: 12px;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    background: #ffffff;
    color: #333;
    font-family: inherit;
    margin-bottom: 25px;
}

.date-input:focus {
    outline: none;
    border-color: #800000;
    box-shadow: 0 0 0 4px rgba(128, 0, 0, 0.1);
}

.input-hint {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 25px;
    font-style: italic;
}

/* Current Date Display */
.current-date-section {
    background: #ffffff;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    margin-top: 15px;
}

.current-date-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.calendar-icon {
    font-size: 1.2rem;
}

.current-date-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #800000;
    margin-bottom: 15px;
    text-align: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.date-details {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    font-size: 1.1rem;
    color: #5d6d7e;
    text-align: center;
}

.day-name {
    color: #2c3e50;
    font-weight: 600;
}

.month-name {
    color: #800000;
    font-weight: 600;
}

.day-number {
    color: #2c3e50;
    font-weight: 700;
}

.year-number {
    color: #2c3e50;
    font-weight: 600;
}

/* Buttons */
.button-container {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 30px;
}

.btn {
    flex: 1;
    min-width: 180px;
    padding: 18px 32px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-family: inherit;
}

.btn:focus {
    outline: 3px solid rgba(128, 0, 0, 0.3);
    outline-offset: 3px;
}

.btn-calculate {
    background: linear-gradient(135deg, #800000 0%, #660000 100%);
    color: #ffffff;
}

.btn-calculate:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(128, 0, 0, 0.2);
}

.btn-reset {
    background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
    color: #ffffff;
}

.btn-reset:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(44, 62, 80, 0.2);
}

/* Maroon Header */
.maroon-header {
    background: #800000;
    color: #ffffff;
    padding: 24px 40px;
    text-align: center;
}

.maroon-header h2 {
    font-size: 1.6rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
}

/* Primary Result */
.primary-result-strip {
    margin: 0;
}

.primary-result-content {
    padding: 60px 40px;
    text-align: center;
    background: #ffffff;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.primary-result-content .result-display {
    font-size: 2.8rem;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.3;
    word-wrap: break-word;
    word-break: keep-all;
}

.placeholder-text {
    color: #adb5bd;
    font-weight: 400;
    font-size: 1.6rem;
    opacity: 0.7;
}

/* Detailed Breakdown */
.detailed-breakdown {
    border-top: 1px solid #e9ecef;
}

.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    padding: 40px;
    background: #ffffff;
}

.breakdown-item {
    background: #f8f9fa;
    padding: 35px 30px;
    border-radius: 15px;
    border-left: 6px solid #800000;
    transition: transform 0.3s ease;
}

.breakdown-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.breakdown-value {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 15px;
    word-wrap: break-word;
    word-break: keep-all;
    line-height: 1.3;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.breakdown-label {
    font-size: 1.2rem;
    color: #5d6d7e;
    font-weight: 500;
    text-align: center;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
}

/* Footer */
.calculator-footer {
    text-align: center;
    padding: 30px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    color: #5d6d7e;
    font-weight: 500;
}

/* Live Date Animation */
@keyframes dateUpdate {
    0% { opacity: 0.8; transform: scale(0.98); }
    50% { opacity: 1; transform: scale(1.02); }
    100% { opacity: 1; transform: scale(1); }
}

.date-updating {
    animation: dateUpdate 0.5s ease;
}

/* Responsive Design */
@media (max-width: 992px) {
    .breakdown-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        padding: 30px;
        gap: 20px;
    }
    
    .breakdown-item {
        padding: 30px 25px;
    }
    
    .breakdown-value {
        font-size: 1.8rem;
    }
}

@media (max-width: 768px) {
    body {
        padding: 15px;
    }

    .calculator-header h1 {
        font-size: 2.2rem;
    }

    .subtitle {
        font-size: 1.1rem;
    }

    .input-section {
        padding: 30px 25px;
    }

    .current-date-section {
        padding: 15px;
    }

    .current-date-value {
        font-size: 1.5rem;
        padding: 10px;
    }

    .date-details {
        font-size: 1rem;
        flex-direction: column;
        gap: 5px;
    }

    .button-container {
        flex-direction: column;
    }

    .btn {
        min-width: 100%;
    }

    .maroon-header {
        padding: 20px 25px;
    }

    .maroon-header h2 {
        font-size: 1.4rem;
    }

    .primary-result-content {
        padding: 40px 25px;
        min-height: 140px;
    }

    .primary-result-content .result-display {
        font-size: 2.2rem;
    }

    .breakdown-grid {
        grid-template-columns: 1fr;
        padding: 25px;
        gap: 15px;
    }

    .breakdown-item {
        padding: 25px 20px;
    }

    .breakdown-value {
        font-size: 1.6rem;
        min-height: 50px;
    }
}

@media (max-width: 480px) {
    .calculator-header h1 {
        font-size: 1.9rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .input-section {
        padding: 25px 20px;
    }

    .current-date-value {
        font-size: 1.3rem;
    }

    .primary-result-content {
        padding: 35px 20px;
    }

    .primary-result-content .result-display {
        font-size: 1.9rem;
    }

    .breakdown-value {
        font-size: 1.4rem;
    }

    .breakdown-label {
        font-size: 1.1rem;
    }
}

/* Print Styles */
@media print {
    .button-container,
    .calculator-footer {
        display: none;
    }

    .calculator-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .date-input {
        border: 1px solid #999;
    }

    .current-date-section {
        border: 1px solid #999;
        background: #f0f0f0;
    }

    .primary-result-content,
    .breakdown-grid {
        break-inside: avoid;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(128, 0, 0, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(128, 0, 0, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(128, 0, 0, 0);
    }
}

.calculator-card {
    animation: fadeInUp 0.6s ease-out;
}

.btn-calculate {
    animation: pulse 2s infinite;
}

.breakdown-item {
    animation: fadeInUp 0.4s ease-out;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

:focus-visible {
    outline: 3px solid #800000;
    outline-offset: 3px;
}

/* Loading State */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #800000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
}

@keyframes spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}