/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@300;400;500;600&family=Inter:wght@300;400;500;600&display=swap');

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Fix for container and card alignment */
.container,
.results-cards,
.result-card,
.stats-overview,
.action-controls,
.results-table {
    box-sizing: border-box;
}

:root {
    /* Original Dark Theme Colors */
    --dark-primary: #2C3E50;
    --dark-secondary: #34495E;
    --accent-gold: #F1C40F;
    --accent-orange: #E67E22;
    --text-light: #ECF0F1;
    --text-muted: #BDC3C7;
    
    /* Kid-friendly accent colors */
    --kid-pink: #FF6B9D;
    --kid-blue: #4ECDC4;
    --kid-yellow: #FFE66D;
    --kid-purple: #A8E6CF;
    
    /* Neutral colors */
    --white: #FFFFFF;
    --light-gray: #F8F9FA;
    --gray: #6C757D;
    --dark-gray: #343A40;
    
    /* Rounded corners for kid-friendly design */
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --radius-full: 50px;
    
    /* Soft shadows */
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 8px 30px rgba(0, 0, 0, 0.15);
    --shadow-strong: 0 16px 40px rgba(0, 0, 0, 0.2);
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-gray);
    /* UPDATED: Support for custom background image */
    background: var(--white);
    background-attachment: fixed;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

/* Custom background image class */
body.custom-bg {
    background-image: url('../image/bg.jpg'); /* Replace with your image path */
    /* Add overlay to reduce image opacity */
    position: relative;
}

/* Fallback gradient if no custom image */
body:not(.custom-bg) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #667eea 100%);
}

/* Background overlay for better text readability */
.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* UPDATED: Increase overlay opacity to reduce background image visibility */
    background: rgba(255, 255, 255, 0.7); /* Increased from 0.1 to 0.7 */
    pointer-events: none;
    z-index: -2;
}

/* Kid-Friendly Background Pattern */
.background-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.pattern-dots {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.1) 2px, transparent 2px);
    background-size: 50px 50px;
    animation: float 20s ease-in-out infinite;
}

.pattern-shapes {
    position: absolute;
    width: 100%;
    height: 100%;
}

.pattern-shapes > div {
    position: absolute;
    font-size: 2rem;
    opacity: 0.1;
    animation: floatAround 15s linear infinite;
}

.shape-heart {
    top: 15%;
    left: 10%;
    animation-duration: 18s;
}

.shape-star {
    top: 70%;
    right: 15%;
    animation-duration: 12s;
    animation-delay: 4s;
}

.shape-smile {
    top: 40%;
    right: 20%;
    animation-duration: 16s;
    animation-delay: 8s;
}

.shape-rainbow {
    bottom: 20%;
    left: 20%;
    animation-duration: 14s;
    animation-delay: 2s;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes floatAround {
    0% { transform: translateX(0) translateY(0) rotate(0deg); }
    25% { transform: translateX(30px) translateY(-20px) rotate(90deg); }
    50% { transform: translateX(60px) translateY(10px) rotate(180deg); }
    75% { transform: translateX(30px) translateY(20px) rotate(270deg); }
    100% { transform: translateX(0) translateY(0) rotate(360deg); }
}

/* Header Styles - Original Dark Theme */
.main-header {
    background: var(--dark-primary);
    box-shadow: var(--shadow-strong);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 9999;
}

.header-container { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 0.8rem 2rem; 
    max-width: 1400px; 
    margin: 0 auto; }

/* Logo Section - Enhanced */
.logo-section .logo-link {
    text-decoration: none;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-icon {
    width: 45px;
    height: 45px;
    background: var(--accent-gold);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--dark-primary);
    box-shadow: var(--shadow-medium);
    transition: all 0.3s ease;
}

.brand-icon:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: var(--shadow-strong);
    background: var(--kid-yellow);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent-gold);
    line-height: 1;
    letter-spacing: 1px;
}

.brand-subtitle {
    font-family: 'Fredoka', sans-serif;
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
    line-height: 1;
    letter-spacing: 0.5px;
}

/* Header Title */
.header-title {
    flex-grow: 1;
    text-align: center;
    margin: 0 2rem;
}

.header-title h1 {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--accent-gold);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 1px;
}

/* User Section - Enhanced */
.user-section {
    display: flex;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: var(--dark-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-soft);
    transition: all 0.3s ease;
}

.user-info:hover {
    background: var(--accent-gold);
    color: var(--dark-primary);
    transform: scale(1.05);
}

.user-info:hover .user-avatar i {
    color: var(--dark-primary);
}

.user-info:hover .user-details {
    color: var(--dark-primary);
}

.user-avatar i {
    font-size: 1.5rem;
    color: var(--accent-gold);
    transition: all 0.3s ease;
}

.user-details {
    display: flex;
    flex-direction: column;
    color: var(--text-light);
}

.user-greeting {
    font-size: 0.85rem;
    opacity: 0.9;
    font-weight: 500;
}

.username {
    font-weight: 600;
    font-size: 1rem;
}

.login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--accent-gold);
    border-radius: var(--radius-full);
    text-decoration: none;
    box-shadow: var(--shadow-medium);
    transition: all 0.3s ease;
}

.login-btn:hover {
    transform: scale(1.1) rotate(-5deg);
    box-shadow: var(--shadow-strong);
    background: var(--kid-yellow);
}

.login-icon i {
    font-size: 1.2rem;
    color: var(--dark-primary);
}

/* Navigation - Original Dark Theme */
.main-nav {
    background: var(--dark-secondary);
    padding: 0.6rem 0;
    box-shadow: inset 0 2px 0 rgba(241, 196, 15, 0.3);
}

.nav-container {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    flex-wrap: wrap;
}

/* Hamburger Menu Toggle */
.hamburger-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10000;
}

.hamburger-toggle .bar {
    width: 100%;
    height: 3px;
    background: var(--accent-gold);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-toggle.active .bar:nth-child(1) {
    transform: translateY(10.5px) rotate(45deg);
}

.hamburger-toggle.active .bar:nth-child(2) {
    opacity: 0;
}

.hamburger-toggle.active .bar:nth-child(3) {
    transform: translateY(-10.5px) rotate(-45deg);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-light);
    text-decoration: none;
    padding: 0.5rem 1.2rem;
    border-radius: var(--radius-lg);
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    background: transparent;
}

.nav-item:hover:not(.nav-active) {
    background: rgba(241, 196, 15, 0.2);
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-soft);
}

.nav-item.nav-active {
    background: var(--accent-gold);
    color: var(--dark-primary);
    transform: translateY(-5px);
    box-shadow: var(--shadow-medium);
    font-weight: 600;
}

.nav-item.nav-active i {
    color: var(--dark-primary);
    transform: scale(1.2);
}

.nav-item.nav-logout {
    background: var(--kid-pink);
    color: var(--white);
}

.nav-item.nav-logout:hover {
    background: #FF1744;
    transform: translateY(-3px) scale(1.05);
}

.nav-item i {
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    padding: 3rem 0;
    position: relative;
    padding-top: 180px;
}

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    align-self: stretch;
}

/* Footer - Original Dark Theme */
.main-footer {
    background: var(--dark-primary);
    color: var(--text-light);
    padding: 2rem 0;
    text-align: center;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.2);
    position: relative;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
}

.footer-content p {
    font-size: 1rem;
    color: var(--text-muted);
}

.footer-hearts {
    display: flex;
    gap: 0.5rem;
}

.footer-hearts i {
    color: var(--kid-pink);
    font-size: 1.2rem;
    animation: heartbeat 1.5s ease-in-out infinite;
}

.footer-hearts i:nth-child(2) {
    animation-delay: 0.3s;
}

.footer-hearts i:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* Button Styles - Kid Friendly */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-lg);
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--shadow-medium);
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--kid-blue);
    color: var(--white);
}

.btn-secondary {
    background: var(--kid-purple);
    color: var(--dark-primary);
}

.btn-warning {
    background: var(--kid-yellow);
    color: var(--dark-primary);
}

.btn-danger {
    background: var(--kid-pink);
    color: var(--white);
}

/* Alert Styles - Kid Friendly */
.alert {
    padding: 1rem 1.5rem;
    margin: 1rem 0;
    border-radius: var(--radius-lg);
    border: none;
    position: relative;
    box-shadow: var(--shadow-soft);
}

.alert-success {
    background: var(--kid-purple);
    color: var(--dark-primary);
}

.alert-danger {
    background: var(--kid-pink);
    color: var(--white);
}

.alert-warning {
    background: var(--kid-yellow);
    color: var(--dark-primary);
}

.alert-info {
    background: var(--kid-blue);
    color: var(--white);
}

/* Form Styles - Kid Friendly */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark-gray);
    font-family: 'Fredoka', sans-serif;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--white);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--kid-blue);
    box-shadow: 0 0 0 0.2rem rgba(78, 205, 196, 0.25);
    transform: translateY(-2px);
}

/* Responsive Design */
@media (max-width: 992px) {
    .header-container {
        padding: 0.9rem 1.5rem;
    }
    
    .header-title h1 {
        font-size: 1.2rem;
    }
    
    .nav-container {
        padding: 0 1.5rem;
    }

    .main-content {
        padding-top: 200px;
    }
}

@media (max-width: 768px) {
    .header-container {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        padding: 0.8rem 1rem;
    }
    
    .logo-section {
        display: none;
    }
    
    .logo-container {
        gap: 0.5rem;
    }
    
    .brand-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
        flex-shrink: 0;
    }
    
    .brand-text {
        display: none;
    }
    
    .header-title {
        flex: 1;
        text-align: center;
        margin: 0 0.5rem;
    }
    
    .header-title h1 {
        font-size: 0.82rem;
        line-height: 1.3;
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }
    
    .user-section {
        flex-shrink: 0;
    }
    
    .user-info {
        padding: 0.4rem 0.8rem;
        gap: 0.4rem;
    }
    
    .user-avatar i {
        font-size: 1.4rem;
    }
    
    .user-details {
        display: none;
    }
    
    .login-btn {
        width: 36px;
        height: 36px;
    }
    
    .login-icon i {
        font-size: 1rem;
    }
    
    /* Hamburger Menu */
    .hamburger-toggle {
        display: flex;
        flex-shrink: 0;
    }
    
    .main-nav {
        padding: 0;
        box-shadow: none;
    }

    .nav-container {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.35s ease;
        padding: 0;
    }
    
    .nav-container.active {
        max-height: 600px;
        padding: 0.5rem 1rem 0.8rem;
    }
    
    .nav-item {
        width: 100%;
        justify-content: flex-start;
        padding: 0.75rem 1rem;
        border-radius: var(--radius-md);
        margin-bottom: 0.2rem;
        transform: none !important;
    }
    
    .nav-item:last-child {
        margin-bottom: 0;
    }
    
    .nav-item span {
        font-size: 0.95rem;
    }
    
    .nav-item.nav-active {
        transform: none !important;
    }

    .main-content {
        padding-top: 150px;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    .pattern-shapes {
        display: none;
    }
    
    .header-container {
        padding: 0.65rem 0.75rem;
    }
    
    .header-title h1 {
        font-size: 0.72rem;
    }

    .brand-icon {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    .hamburger-toggle {
        width: 26px;
        height: 20px;
    }
    
    .nav-container.active {
        padding: 0.4rem 0.75rem 0.6rem;
    }
    
    .nav-item {
        padding: 0.65rem 0.8rem;
    }

    .nav-item span {
        font-size: 0.9rem;
    }
    
    .container {
        padding: 0 0.75rem;
    }

    .main-content {
        padding-top: 130px;
    }
}

/* Desktop - Cards match header width */
@media (min-width: 993px) {
    .welcome-section,
    .training-form,
    .training-results,
    .form-section,
    .result-display,
    .model-info-section,
    .stats-overview,
    .action-controls,
    .results-table,
    .empty-state {
        width: 100%;
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }

.d-flex { display: flex; }
.d-block { display: block; }

/* Loading animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading {
    animation: spin 1s linear infinite;
}
