:root {
    --primary-color: #4A90E2;
    /* Soft Pediatric Blue */
    --accent-color: #FF6B6B;
    /* Warm Corally Red */
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.5);
    --text-main: #2D3436;
    --text-secondary: #636E72;
    --radius-lg: 24px;
    --radius-md: 16px;
    --spacing-md: 20px;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Center content vertically */
    align-items: center;
    overflow-x: hidden;
    padding: 20px;
}

/* Background decoration */
body::before {
    content: '';
    position: fixed;
    top: -100px;
    left: -100px;
    width: 300px;
    height: 300px;
    background: rgba(74, 144, 226, 0.2);
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
}

body::after {
    content: '';
    position: fixed;
    bottom: -50px;
    right: -50px;
    width: 250px;
    height: 250px;
    background: rgba(255, 107, 107, 0.15);
    border-radius: 50%;
    filter: blur(60px);
    z-index: -1;
}

/* Main Container */
.app-container {
    width: 100%;
    max-width: 420px;
    /* Mobile width cap */
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.dashboard-container {
    text-align: center;
}

/* Hero Section */
.hero-section {
    text-align: center;
    animation: fadeInDown 0.8s ease-out;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.6);
    padding: 8px 16px;
    border-radius: 30px;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 20px;
    backdrop-filter: blur(4px);
    border: 1px solid var(--glass-border);
}

.main-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
    margin-bottom: 12px;
}

.main-title span {
    color: var(--primary-color);
}

.sub-text {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 auto;
    max-width: 80%;
}

/* Login Card */
.login-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-control-custom {
    width: 100%;
    padding: 16px;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    background: #fff;
    font-size: 1rem;
    color: var(--text-main);
    transition: all 0.3s ease;
    outline: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.form-control-custom:focus {
    border-color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.1);
}

.btn-primary-custom {
    background: var(--primary-color);
    color: white;
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.btn-primary-custom:active {
    transform: scale(0.98);
}

.btn-google {
    background: white;
    color: var(--text-main);
    border: 1px solid #eee;
    margin-top: 12px;
}

.divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
    font-size: 0.85rem;
    color: #999;
}

.divider::before,
.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: #eee;
}

.divider::before {
    left: 0;
}

.divider::after {
    right: 0;
}

/* Logged In State */
.profile-header {
    text-align: center;
    margin-bottom: 25px;
}

.avatar-circle {
    width: 80px;
    height: 80px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    margin: 0 auto 15px;
    box-shadow: 0 10px 20px rgba(74, 144, 226, 0.2);
}

.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
}

.action-card {
    background: white;
    padding: 20px;
    border-radius: var(--radius-md);
    text-align: center;
    text-decoration: none;
    color: var(--text-main);
    transition: all 0.2s;
    border: 1px solid transparent;
}

.action-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    border-color: var(--primary-color);
}

.action-card i {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 8px;
    display: block;
}

.logout-link {
    display: block;
    text-align: center;
    margin-top: 20px;
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

/* 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);
    }
}

/* Mobile optimizations */
@media (max-width: 480px) {
    body {
        padding: 15px;
    }

    .main-title {
        font-size: 1.8rem;
    }
}

/* Dashboard QR Card Specifics */
.qr-container {
    background: white;
    padding: 20px;
    border-radius: var(--radius-md);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    margin: 20px auto;
    width: auto;
    /* Ensures container wraps content tightly */
    display: inline-flex;
    justify-content: center;
    align-items: center;
    position: relative;
    min-width: 240px;
    /* Min width to frame QR nicely */
    min-height: 240px;
}

#qrcode {
    display: flex;
    justify-content: center;
    align-items: center;
}

#qrcode img {
    margin: 0 auto;
    display: block;
}

/* Custom QR Overlay (CTK Badge) */
.qr-overlay-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    color: var(--primary-color);
    font-weight: 800;
    font-size: 1.2rem;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border: 3px solid white;
    z-index: 10;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-color);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(255, 107, 107, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0);
    }
}

.pulse-dot.success {
    background: #34C759;
    animation: pulse-success 1.5s infinite;
}

@keyframes pulse-success {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(52, 199, 89, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(52, 199, 89, 0);
    }
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.back-btn {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.2s;
}

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