/* Reset และ Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

/* Container และ Card Styles */
.container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.card {
    background: white;
    border-radius: 25px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 1200px;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

/* Background Circles Animation */
.bg-circles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
}

.circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: float 6s ease-in-out infinite;
}

.circle1 {
    width: 80px;
    height: 80px;
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.circle2 {
    width: 120px;
    height: 120px;
    top: 20%;
    right: 10%;
    animation-delay: 2s;
}

.circle3 {
    width: 60px;
    height: 60px;
    bottom: 20%;
    left: 20%;
    animation-delay: 4s;
}

.circle4 {
    width: 100px;
    height: 100px;
    bottom: 10%;
    right: 20%;
    animation-delay: 1s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
    }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: #2d3748;
    font-weight: bold;
    margin-bottom: 15px;
}

h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    margin-bottom: 30px;
}

h2 {
    font-size: 2rem;
    color: #4a5568;
}

h3 {
    font-size: 1.5rem;
    color: #2d3748;
}

/* Button Styles */
.btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #f093fb, #f5576c);
}

.btn-secondary:hover {
    box-shadow: 0 8px 25px rgba(240, 147, 251, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
}

.btn-danger:hover {
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
}

/* Unit Button List */
.unit-btn-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 30px 0;
}

.unit-btn {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 15px;
    padding: 25px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.unit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.unit-btn h3 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.unit-btn p {
    color: #666;
    line-height: 1.5;
    margin: 0;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #2d3748;
}

.form-input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8fafc;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: white;
}

/* Quiz Styles */
.quiz-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.quiz-question {
    font-size: 1.2rem;
    font-weight: bold;
    color: #2d3748;
    margin-bottom: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border-radius: 15px;
    border-left: 5px solid #667eea;
}

.quiz-options {
    display: grid;
    gap: 15px;
    margin-bottom: 30px;
}

.quiz-option {
    padding: 15px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    font-size: 1rem;
}

.quiz-option:hover {
    border-color: #667eea;
    background: #f8fafc;
    transform: translateX(5px);
}

.quiz-option.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.quiz-option.correct {
    border-color: #48bb78;
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
}

.quiz-option.incorrect {
    border-color: #f56565;
    background: linear-gradient(135deg, #f56565, #e53e3e);
    color: white;
}

/* History Styles */
.history-item {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-left: 5px solid #667eea;
    transition: all 0.3s ease;
}

.history-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.history-score {
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
}

.history-date {
    color: #718096;
    font-size: 0.9rem;
}

/* Alert Styles */
.alert {
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-weight: bold;
}

.alert-success {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
}

.alert-error {
    background: linear-gradient(135deg, #f56565, #e53e3e);
    color: white;
}

.alert-info {
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
}

/* Navigation */
.nav {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.nav-list {
    list-style: none;
    display: flex;
    gap: 20px;
    justify-content: center;
}

.nav-item {
    padding: 10px 20px;
    border-radius: 25px;
    transition: all 0.3s ease;
}

.nav-item:hover {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .card {
        padding: 30px;
        border-radius: 20px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .btn {
        padding: 12px 24px;
        font-size: 1rem;
    }
    
    .unit-btn-list {
        gap: 15px;
    }
    
    .unit-btn {
        padding: 20px;
    }
    
    .quiz-options {
        grid-template-columns: 1fr;
    }
    
    .nav-list {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .card {
        padding: 20px;
        border-radius: 15px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .unit-btn {
        padding: 15px;
    }
    
    .unit-btn h3 {
        font-size: 1.1rem;
    }
    
    /* Mobile responsive for back links */
    a[href*="index.php"] {
        font-size: 0.85rem !important;
        padding: 6px 10px !important;
        border-radius: 12px !important;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

.slide-in {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 10px;
    background: #e2e8f0;
    border-radius: 5px;
    overflow: hidden;
    margin: 20px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.3s ease;
}

/* Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background: #2d3748;
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
} 