:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #ec4899;
    --secondary-hover: #db2777;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(236, 72, 153, 0.15) 0%, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 850px;
    z-index: 10;
}

header {
    text-align: center;
    margin-bottom: 2.5rem;
    animation: fadeInDown 1s cubic-bezier(0.16, 1, 0.3, 1);
}

header h1 {
    font-size: 2.8rem;
    background: linear-gradient(to right, #818cf8, #f472b6, #818cf8);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 0.5rem;
    animation: gradientMove 5s linear infinite;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

.glow-icon {
    text-shadow: 0 0 15px rgba(99, 102, 241, 0.6);
}

.tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    animation: fadeIn 1s ease 0.2s both;
}

.tab-btn {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.8rem 1.8rem;
    border-radius: 50px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-color: transparent;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: var(--glass-shadow);
    animation: scaleUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
    position: relative;
    overflow: hidden;
}

.tab-content {
    display: none;
    animation: fadeIn 0.5s ease;
}

.tab-content.active {
    display: block;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: rgba(0,0,0,0.2);
    padding: 2rem;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.05);
}

.dual-inputs {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.input-box {
    flex: 1;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-size: 1.1rem;
    font-weight: 600;
    color: #e2e8f0;
}

input[type="date"], .flatpickr-input[type="text"] {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 1.2rem;
    border-radius: 14px;
    font-size: 1.15rem;
    outline: none;
    transition: all 0.3s ease;
    cursor: pointer;
    appearance: none;
    width: 100%;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
    opacity: 0.7;
    transition: 0.3s;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    transform: scale(1.1);
}

input[type="date"]:focus, .flatpickr-input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
    background: rgba(15, 23, 42, 1);
}

.primary-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 1.2rem 2rem;
    border-radius: 14px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    align-self: center;
    margin-top: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 25px -5px var(--primary);
}

.partner-btn {
    background: var(--secondary);
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.3);
    width: 100%;
    justify-content: center;
    margin-top: 1.5rem;
}

.partner-btn:hover {
    background: var(--secondary-hover);
    box-shadow: 0 10px 25px -5px var(--secondary);
}

.hidden {
    display: none !important;
}

.results-container {
    margin-top: 2rem;
    border-top: 1px solid var(--glass-border);
    padding-top: 2.5rem;
    animation: slideUp 0.6s ease;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.result-card {
    background: linear-gradient(145deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.01) 100%);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2.5rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.result-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.3); border-color: rgba(255,255,255,0.2);
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    transition: 0.3s;
}

.result-card.miladi::before { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.result-card.hijri::before { background: linear-gradient(90deg, #10b981, #34d399); }
.result-card.partner-diff::before { background: linear-gradient(90deg, #ec4899, #f472b6); }

.card-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

.result-card.miladi .card-icon { color: #60a5fa; }
.result-card.hijri .card-icon { color: #34d399; }
.result-card.partner-diff .card-icon { color: #f472b6; }

.result-card h3 {
    font-size: 1.3rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-weight: 700;
}

.age-display {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 1rem;
    line-height: 1.4;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.age-details {
    font-size: 1.05rem;
    color: #cbd5e1;
    line-height: 1.8;
}

.history-section {
    background: rgba(0,0,0,0.25);
    border-radius: 20px;
    padding: 2.5rem;
    border: 1px solid rgba(255,255,255,0.05);
}

.history-section h3 {
    margin-bottom: 2rem;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 1rem;
}

.events-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.events-list li {
    position: relative;
    color: #e2e8f0;
    line-height: 1.7;
    background: rgba(255,255,255,0.03);
    padding: 1.2rem 1.5rem 1.2rem 1.5rem;
    border-radius: 12px;
    border: 1px solid transparent;
    transition: 0.3s;
    font-size: 1.05rem;
}

.events-list li:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.1);
    transform: translateX(-5px);
}

.year-badge {
    display: inline-block;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
    padding: 0.3rem 0.8rem;
    border-radius: 8px;
    font-weight: 800;
    margin-left: 0.8rem;
    font-size: 1.1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.loading {
    text-align: center;
    color: #a5b4fc;
    padding: 3rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.loading i {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: block;
}

.fun-fact {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px dashed rgba(255,255,255,0.1);
    color: #fce7f3;
    font-size: 1.1rem;
    font-style: italic;
}

footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    animation: fadeIn 1s ease 1s both;
}

/* Stats Panel */
.stats-glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem 2rem;
    margin-top: 1.5rem;
    box-shadow: var(--glass-shadow);
    display: flex;
    justify-content: space-around;
    align-items: center;
    animation: slideUp 0.6s ease 0.4s both;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.stat-icon {
    font-size: 1.8rem;
    background: rgba(255,255,255,0.05);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.1);
}

.stat-data {
    display: flex;
    flex-direction: column;
}

.stat-title {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 700;
}

.stat-number {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
}

.pulse-icon {
    animation: pulse 2s infinite;
}

.stats-glass-panel .divider {
    width: 1px;
    height: 60px;
    background: rgba(255,255,255,0.15);
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.8; text-shadow: 0 0 15px rgba(239, 68, 68, 0.8); }
    100% { transform: scale(1); opacity: 1; }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleUp {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

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

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Media Queries */
@media (max-width: 768px) {
    .glass-panel {
        padding: 1.5rem;
    }
    
    header h1 {
        font-size: 2.2rem;
    }
    
    .dual-inputs {
        flex-direction: column;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .tab-btn {
        flex: 1;
        justify-content: center;
        text-align: center;
        min-width: 150px;
    }
    
    .input-group {
        padding: 1.5rem;
    }
    
    .stats-glass-panel {
        flex-direction: column;
        gap: 1.2rem;
        padding: 1.5rem;
    }
    
    .stats-glass-panel .divider {
        width: 100%;
        height: 1px;
    }
    
    .stat-item {
        width: 100%;
        justify-content: flex-start;
        text-align: right;
    }
}
