/* General Reset and Variables */
:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --error-color: #ef4444;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --bg-light: #f1f5f9;
    --bg-white: #ffffff;
    --bg-card: #ffffff;
    --bg-page: #f8fafc;
    --border-color: #cbd5e1;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-page);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0 20px;
}

/* Navigation Styles */
.tool-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
    padding: 0;
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.all-tools-btn {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    padding: 16px 32px;
    background: var(--bg-white);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
}

.all-tools-btn:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

/* Legacy back button styles - kept for compatibility */
.back-btn {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 16px 24px;
    background: var(--bg-white);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-right: 1px solid var(--border-color);
}

.back-btn:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

.site-name {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    padding: 16px 24px;
    letter-spacing: 0.3px;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeInDown 0.6s ease-out;
}

header h1 {
    color: var(--text-primary);
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 400;
}

/* Card Styles */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-xl);
    animation: fadeInUp 0.6s ease-out;
    border: 1px solid var(--border-color);
}

.card h2 {
    color: var(--text-primary);
    font-size: 1.8rem;
    margin-bottom: 25px;
    text-align: center;
}

.card h3 {
    color: var(--text-primary);
    font-size: 1.4rem;
    margin-bottom: 20px;
    text-align: center;
}

/* Date Selector Styles */
.date-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.select-group {
    display: flex;
    flex-direction: column;
}

.select-group label {
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.select-group select {
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--bg-white);
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
}

.select-group select:hover {
    border-color: var(--primary-color);
}

.select-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Input Fields Styling */
input[type="number"],
input[type="text"],
input[type="range"],
textarea {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-white);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

input[type="number"]:focus,
input[type="text"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

input[type="number"]:hover,
input[type="text"]:hover,
textarea:hover {
    border-color: var(--primary-color);
}

input[type="checkbox"] {
    accent-color: var(--primary-color);
}

/* Label styling */
label {
    color: var(--text-primary);
}

/* Button Styles */
.btn-calculate {
    width: 100%;
    padding: 15px 30px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-calculate:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-calculate:active {
    transform: translateY(0);
}

.btn-reset {
    width: 100%;
    padding: 12px 30px;
    background: var(--bg-white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.btn-reset:hover {
    background: var(--primary-color);
    color: #ffffff;
}

/* Error Message */
.error-message {
    background: #fee2e2;
    color: var(--error-color);
    padding: 12px 15px;
    border-radius: 8px;
    margin-top: 15px;
    border-left: 4px solid var(--error-color);
    font-weight: 500;
}

/* Age Display */
.age-display {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    padding: 20px;
}

.age-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 25px 40px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: var(--border-radius);
    color: #ffffff;
    box-shadow: var(--shadow-lg);
}

.age-main .age-number {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1;
}

.age-main .age-label {
    font-size: 1.2rem;
    margin-top: 8px;
    opacity: 0.9;
}

.age-secondary {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 25px;
    background: var(--bg-light);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

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

.age-secondary .age-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
}

.stat-item {
    text-align: center;
    padding: 20px 15px;
    background: var(--bg-light);
    border-radius: 8px;
    transition: all 0.3s ease;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.stat-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--bg-light);
    border-radius: 8px;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.info-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}

.info-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.info-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 3px;
}

.info-value {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* Footer */
footer.tool-footer {
    text-align: center;
    margin-top: auto;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    background: var(--bg-white);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

footer.tool-footer p {
    margin: 0;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (min-width: 1400px) {
    .container {
        max-width: 1400px;
        padding: 0 40px;
    }
}

@media (min-width: 1200px) and (max-width: 1399px) {
    .container {
        max-width: 1200px;
        padding: 0 30px;
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .container {
        max-width: 1000px;
        padding: 0 25px;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .container {
        max-width: 750px;
    }
    
    header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .card {
        padding: 25px;
    }
    
    .tool-nav {
        padding: 15px 20px;
    }
    
    .site-name {
        font-size: 1.15rem;
    }
}

@media (max-width: 767px) {
    header h1 {
        font-size: 2.2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .card {
        padding: 20px;
    }
    
    .tool-nav {
        padding: 0;
    }
    
    .all-tools-btn {
        padding: 14px 24px;
        font-size: 0.95rem;
    }
    
    .back-btn {
        justify-content: center;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 14px 20px;
    }
    
    .site-name {
        font-size: 1.1rem;
        text-align: center;
        order: -1;
        padding: 14px 20px;
        border-bottom: 1px solid var(--border-color);
    }

    .date-selector {
        grid-template-columns: 1fr;
    }

    .age-display {
        flex-direction: column;
        gap: 15px;
    }

    .age-main .age-number {
        font-size: 3rem;
    }

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

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-item {
        padding: 15px 10px;
    }

    .stat-value {
        font-size: 1.3rem;
    }

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

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.8rem;
    }

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

/* Loading State */
.btn-calculate.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-calculate.loading span::after {
    content: '...';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}
