@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6c63ff;
    --primary-light: #8b85ff;
    --secondary: #ff6584;
    --accent: #43e97b;
    --accent2: #38f9d7;
    --bg-dark: #0d0d1a;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.12);
    --text-primary: #f0f0ff;
    --text-secondary: rgba(240, 240, 255, 0.6);
    --shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    position: relative;
}

/* Animated gradient background orbs */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.18;
    z-index: 0;
    animation: float 8s ease-in-out infinite;
}

body::before {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--primary), transparent);
    top: -100px;
    left: -100px;
}

body::after {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--secondary), transparent);
    bottom: -80px;
    right: -80px;
    animation-delay: 4s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

.bg-particle {
    position: fixed;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.12;
    z-index: 0;
    background: radial-gradient(circle, var(--accent2), transparent);
    top: 40%;
    left: 60%;
    animation: float 12s 2s ease-in-out infinite;
}

/* Main Card Container */
.calculator-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 520px;
    padding: 20px;
}

.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 28px;
    padding: 48px 44px;
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.1);
    animation: slideUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(40px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
.card-header {
    text-align: center;
    margin-bottom: 38px;
}

.icon-wrap {
    width: 70px;
    height: 70px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    font-size: 2rem;
    box-shadow: 0 10px 30px rgba(108, 99, 255, 0.4);
    animation: pulse-icon 3s ease-in-out infinite;
}

@keyframes pulse-icon {
    0%, 100% { box-shadow: 0 10px 30px rgba(108, 99, 255, 0.4); }
    50% { box-shadow: 0 14px 40px rgba(108, 99, 255, 0.7); }
}

h1 {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-primary) 40%, var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 400;
    letter-spacing: 0.3px;
}

/* Form Group */
.form-group {
    margin-bottom: 24px;
}

label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    pointer-events: none;
    z-index: 1;
}

input[type="date"] {
    width: 100%;
    padding: 14px 16px 14px 46px;
    background: rgba(255, 255, 255, 0.06);
    border: 1.5px solid var(--glass-border);
    border-radius: 14px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    outline: none;
    transition: all 0.3s ease;
    cursor: pointer;
    -webkit-appearance: none;
    color-scheme: dark;
}

input[type="date"]:hover {
    border-color: rgba(108, 99, 255, 0.5);
    background: rgba(255, 255, 255, 0.09);
}

input[type="date"]:focus {
    border-color: var(--primary);
    background: rgba(108, 99, 255, 0.08);
    box-shadow: 0 0 0 4px rgba(108, 99, 255, 0.2);
}

/* Calculate Button */
.btn-calculate {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border: none;
    border-radius: 14px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 10px 30px rgba(108, 99, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-calculate::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.btn-calculate:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 40px rgba(108, 99, 255, 0.5);
}

.btn-calculate:hover::before {
    opacity: 1;
}

.btn-calculate:active {
    transform: translateY(0px) scale(0.98);
}

.btn-icon {
    font-size: 1.1rem;
    transition: transform 0.4s ease;
}

.btn-calculate:hover .btn-icon {
    transform: rotate(20deg) scale(1.2);
}

/* Result Section */
.result-section {
    margin-top: 28px;
    display: none;
    animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.result-section.visible {
    display: block;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.result-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

.result-divider::before,
.result-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--glass-border);
}

.result-divider span {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    white-space: nowrap;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 16px 12px;
    text-align: center;
    transition: transform 0.3s ease, border-color 0.3s ease;
    cursor: default;
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: rgba(108, 99, 255, 0.4);
}

.stat-card:nth-child(1) { animation: popIn 0.4s 0.05s cubic-bezier(0.16, 1, 0.3, 1) both; }
.stat-card:nth-child(2) { animation: popIn 0.4s 0.15s cubic-bezier(0.16, 1, 0.3, 1) both; }
.stat-card:nth-child(3) { animation: popIn 0.4s 0.25s cubic-bezier(0.16, 1, 0.3, 1) both; }

@keyframes popIn {
    from { opacity: 0; transform: scale(0.85); }
    to   { opacity: 1; transform: scale(1); }
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-light), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* Birthday Info Card */
.birthday-card {
    background: linear-gradient(135deg, rgba(108, 99, 255, 0.12), rgba(67, 233, 123, 0.08));
    border: 1px solid rgba(108, 99, 255, 0.25);
    border-radius: 16px;
    padding: 18px 20px;
    animation: popIn 0.4s 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.birthday-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.birthday-emoji {
    font-size: 1.8rem;
    flex-shrink: 0;
    animation: wiggle 2.5s ease-in-out infinite;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-8deg); }
    75% { transform: rotate(8deg); }
}

.birthday-info {
    flex: 1;
}

.birthday-date {
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 3px;
}

.birthday-countdown {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 400;
}

.days-badge {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 20px;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(108, 99, 255, 0.4);
    flex-shrink: 0;
}

/* Error state */
.error-msg {
    background: rgba(255, 101, 132, 0.1);
    border: 1px solid rgba(255, 101, 132, 0.3);
    border-radius: 12px;
    padding: 14px 16px;
    color: #ff8fa8;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    animation: fadeInUp 0.4s ease both;
}

/* Footer */
.card-footer {
    text-align: center;
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid var(--glass-border);
}

.card-footer p {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 400;
}

.card-footer strong {
    color: var(--primary-light);
    font-weight: 600;
}

/* Responsive */
@media (max-width: 480px) {
    .card {
        padding: 34px 24px;
        border-radius: 22px;
    }

    h1 { font-size: 1.5rem; }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .stat-value { font-size: 1.5rem; }
}