* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

:root {
    --primary-color: #1e88e5;
    --secondary-color: #0d47a1;
    --background-color: #f9f9f9;
    --card-color: #ffffff;
    --text-color: #333333;
    --border-radius: 12px;
    --box-shadow: 0 10px 20px rgba(30, 136, 229, 0.15);
    --header-height: 70px;
    --footer-height: 60px;
}

body {
    background-color: var(--background-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-image: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--text-color);
}

/* Header and Navigation */
header {
    background-color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--header-height);
}

.main-nav {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 20px;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.logo i {
    margin-right: 10px;
    font-size: 1.8rem;
}

/* Language Menu */
.language-menu {
    position: relative;
}

.lang-btn {
    display: flex;
    align-items: center;
    background: none;
    border: 1px solid #e1e1e1;
    border-radius: 5px;
    padding: 8px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    background-color: #f5f5f5;
}

.lang-btn.active {
    border-color: var(--primary-color);
}

.lang-btn img {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    border-radius: 50%;
    object-fit: cover;
}

.language-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 200px;
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    padding: 10px 0;
    margin-top: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 100;
}

.language-menu:hover .language-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    display: flex;
    align-items: center;
    padding: 8px 15px;
    color: var(--text-color);
    text-decoration: none;
    transition: background-color 0.3s;
}

.lang-option:hover {
    background-color: #f5f5f5;
}

.lang-option img {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    border-radius: 50%;
    object-fit: cover;
}

/* Main Content */
.container {
    width: 100%;
    max-width: 600px;
    margin: calc(var(--header-height) + 30px) auto 30px;
    padding: 0 20px;
}

.calculator {
    background-color: var(--card-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    padding: 30px;
    transition: all 0.3s ease;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.header h1 {
    color: var(--primary-color);
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 5px;
}

.header p {
    color: #888;
    font-size: 16px;
}

.input-section {
    margin-bottom: 30px;
}

.date-row {
    margin-bottom: 25px;
}

.date-row label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-color);
    font-weight: 500;
    font-size: 16px;
}

.date-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
}

.select-container {
    position: relative;
    flex: 1;
}

.select-container select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e1e1;
    border-radius: 8px;
    font-size: 16px;
    appearance: none;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.3s;
    padding-right: 30px;
}

html[dir="rtl"] .select-container select {
    padding-right: 15px;
    padding-left: 30px;
}

.select-container select:focus {
    border-color: var(--primary-color);
    outline: none;
}

.select-label {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 12px;
    pointer-events: none;
}

html[dir="rtl"] .select-label {
    right: auto;
    left: 10px;
}

.calendar-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.3s;
}

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

.hidden-date {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

button#calculate-btn {
    width: 100%;
    padding: 14px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    letter-spacing: 1px;
    margin-top: 10px;
}

button#calculate-btn:hover {
    background-color: var(--secondary-color);
}

button#calculate-btn:active {
    transform: scale(0.98);
}

.result-section {
    opacity: 0;
    height: 0;
    overflow: hidden;
    transition: all 0.5s ease;
}

.result-section.active {
    opacity: 1;
    height: auto;
    margin-top: 20px;
}

.result-card {
    background: linear-gradient(135deg, #1e88e5 0%, #0d47a1 100%);
    border-radius: var(--border-radius);
    padding: 25px;
    color: white;
    text-align: center;
    margin-bottom: 20px;
}

.result-card h2 {
    font-size: 24px;
    margin-bottom: 20px;
    font-weight: 600;
}

.age-display {
    display: flex;
    justify-content: space-around;
    margin-top: 10px;
}

.age-box {
    text-align: center;
    min-width: 80px;
}

.age-box span {
    font-size: 42px;
    font-weight: 700;
    display: block;
}

.age-box p {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 5px;
}

.details-section {
    background-color: #f5f5f5;
    border-radius: var(--border-radius);
    padding: 20px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 16px;
}

.detail-item:last-child {
    margin-bottom: 0;
}

.detail-label {
    color: #666;
}

.detail-value {
    font-weight: 600;
    color: var(--text-color);
}

/* Footer */
footer {
    background-color: white;
    padding: 20px 0;
    margin-top: auto;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-links a {
    color: var(--primary-color);
    font-size: 20px;
    transition: color 0.3s;
}

.social-links a:hover {
    color: var(--secondary-color);
}

/* RTL support for Arabic */
html[dir="rtl"] .calculator {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .detail-item {
    flex-direction: row-reverse;
}

html[dir="rtl"] .logo i {
    margin-right: 0;
    margin-left: 10px;
}

html[dir="rtl"] .lang-btn img,
html[dir="rtl"] .lang-option img {
    margin-right: 0;
    margin-left: 8px;
}

html[dir="rtl"] .language-dropdown {
    right: auto;
    left: 0;
}

/* Font adjustments for different languages */
html[lang="ar"] * {
    font-family: 'Amiri', 'Poppins', sans-serif;
}

html[lang="zh"] *,
html[lang="ja"] * {
    font-family: 'Noto Sans SC', 'Noto Sans JP', 'Poppins', sans-serif;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .container {
        margin-top: calc(var(--header-height) + 20px);
    }
    
    .footer-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .calculator {
        padding: 20px;
    }
    
    .header h1 {
        font-size: 28px;
    }
    
    .date-inputs {
        flex-wrap: wrap;
    }
    
    .select-container {
        flex-basis: 30%;
    }
    
    .calendar-btn {
        margin-top: 10px;
    }
    
    .age-box span {
        font-size: 36px;
    }
    
    .detail-item {
        font-size: 14px;
    }
    
    .main-nav {
        padding: 0 15px;
    }
    
    .logo span {
        display: none;
    }
    
    .lang-btn span {
        display: none;
    }
} 