/* ============================================
   Health Checkup Booking System - Styles
   ============================================ */

:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --secondary: #48bb78;
    --secondary-dark: #38a169;
    --danger: #f56565;
    --warning: #ed8936;
    --dark: #2d3748;
    --light: #f7fafc;
    --gray: #718096;
    --gray-light: #e2e8f0;
    
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --gradient-warm: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --radius: 12px;
    --radius-lg: 20px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Prompt', 'Sarabun', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    color: var(--dark);
    line-height: 1.6;
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    padding: 40px 20px;
    color: white;
}

.header-icon {
    width: 80px;
    height: 80px;
    background: var(--gradient-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 40px;
    box-shadow: 0 10px 40px rgba(72, 187, 120, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main Card */
.main-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 40px;
    margin-bottom: 30px;
}

/* Steps Indicator */
.steps {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--gray-light);
    border-radius: 50px;
    color: var(--gray);
    font-weight: 500;
    transition: all 0.3s ease;
}

.step.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.step.completed {
    background: var(--gradient-secondary);
    color: white;
}

.step-number {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* Section */
.section {
    display: none;
    animation: fadeIn 0.4s ease;
}

.section.active {
    display: block;
}

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

.section-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--gray-light);
}

/* Group Selection */
.group-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.group-card {
    background: white;
    border: 2px solid var(--gray-light);
    border-radius: var(--radius);
    padding: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.group-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.group-card:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.group-card:hover::before {
    transform: scaleX(1);
}

.group-card.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

.group-card.selected::before {
    transform: scaleX(1);
}

.group-icon {
    width: 60px;
    height: 60px;
    background: var(--gradient-primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 20px;
}

.group-card:nth-child(2) .group-icon {
    background: var(--gradient-secondary);
}

.group-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 10px;
}

.group-period {
    color: var(--gray);
    font-size: 0.95rem;
}

.group-period strong {
    color: var(--primary);
}

/* Date Selection */
.date-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
    padding: 5px;
}

.date-card {
    background: white;
    border: 2px solid var(--gray-light);
    border-radius: var(--radius);
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.date-card:hover:not(.disabled) {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.date-card.selected {
    border-color: var(--primary);
    background: var(--gradient-primary);
    color: white;
}

.date-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--gray-light);
}

.date-day {
    font-size: 1.5rem;
    font-weight: 700;
}

.date-month {
    font-size: 0.85rem;
    opacity: 0.8;
}

.date-weekday {
    font-size: 0.8rem;
    margin-top: 5px;
    opacity: 0.7;
}

.date-slots {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--gray-light);
    font-size: 0.75rem;
}

.date-card.selected .date-slots {
    border-top-color: rgba(255, 255, 255, 0.3);
}

.slot-info {
    display: flex;
    justify-content: space-between;
    margin-top: 3px;
}

.slot-full {
    color: var(--danger);
}

.slot-available {
    color: var(--secondary);
}

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

.form-label {
    display: block;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
}

.form-label .required {
    color: var(--danger);
}

.form-input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid var(--gray-light);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.form-input.error {
    border-color: var(--danger);
}

.form-hint {
    font-size: 0.85rem;
    color: var(--gray);
    margin-top: 5px;
}

.form-error {
    font-size: 0.85rem;
    color: var(--danger);
    margin-top: 5px;
    display: none;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* Slot Info Box */
.slot-info-box {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 25px;
}

.slot-info-box h4 {
    color: var(--primary);
    margin-bottom: 10px;
}

.slot-info-box p {
    color: var(--dark);
    margin: 5px 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 30px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn-secondary {
    background: var(--gray-light);
    color: var(--dark);
}

.btn-secondary:hover {
    background: #d1d5db;
}

.btn-success {
    background: var(--gradient-secondary);
    color: white;
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.4);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(72, 187, 120, 0.5);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-group {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--gray-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 20px;
    color: var(--gray);
    font-weight: 500;
}

/* Summary */
.summary-card {
    background: linear-gradient(135deg, rgba(72, 187, 120, 0.1) 0%, rgba(56, 161, 105, 0.1) 100%);
    border-radius: var(--radius);
    padding: 25px;
    margin-bottom: 20px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.summary-row:last-child {
    border-bottom: none;
}

.summary-label {
    color: var(--gray);
    font-weight: 500;
}

.summary-value {
    color: var(--dark);
    font-weight: 600;
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.footer a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header {
        padding: 30px 15px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .main-card {
        padding: 25px 20px;
    }
    
    .steps {
        gap: 10px;
    }
    
    .step {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    .step-number {
        width: 24px;
        height: 24px;
        font-size: 0.85rem;
    }
    
    .group-cards {
        grid-template-columns: 1fr;
    }
    
    .date-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--gray);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--dark);
}

/* Check Booking Button */
.check-booking-section {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 2px dashed var(--gray-light);
}

.check-booking-section h3 {
    font-size: 1.1rem;
    color: var(--gray);
    margin-bottom: 15px;
    font-weight: 500;
}

.btn-check-booking {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.4);
    padding: 12px 25px;
    font-size: 1rem;
}

.btn-check-booking:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(240, 147, 251, 0.5);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal */
.modal {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-xl);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    background: var(--gradient-primary);
    color: white;
    padding: 20px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.modal-body {
    padding: 25px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 15px 25px;
    background: var(--light);
    border-top: 1px solid var(--gray-light);
    text-align: center;
}

/* Search Form in Modal */
.search-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-form .form-input {
    flex: 1;
}

.search-form .btn {
    padding: 15px 25px;
    white-space: nowrap;
}

/* Booking Result Card */
.booking-result {
    background: linear-gradient(135deg, rgba(72, 187, 120, 0.1) 0%, rgba(56, 161, 105, 0.1) 100%);
    border: 2px solid var(--secondary);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 15px;
}

.booking-result:last-child {
    margin-bottom: 0;
}

.booking-result-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(72, 187, 120, 0.3);
}

.booking-result-icon {
    width: 45px;
    height: 45px;
    background: var(--gradient-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.booking-result-title {
    flex: 1;
}

.booking-result-title h4 {
    font-size: 1.1rem;
    color: var(--dark);
    margin-bottom: 3px;
}

.booking-result-title span {
    font-size: 0.85rem;
    color: var(--gray);
}

.booking-result-details {
    display: grid;
    gap: 10px;
}

.booking-detail-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.booking-detail-row .icon {
    width: 28px;
    height: 28px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.booking-detail-row .label {
    color: var(--gray);
    font-size: 0.9rem;
    min-width: 80px;
}

.booking-detail-row .value {
    color: var(--dark);
    font-weight: 600;
    flex: 1;
}

/* No Result State */
.no-result {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray);
}

.no-result-icon {
    width: 80px;
    height: 80px;
    background: var(--gray-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2.5rem;
}

.no-result h4 {
    color: var(--dark);
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.no-result p {
    font-size: 0.95rem;
}

/* Loading State in Modal */
.modal-loading {
    text-align: center;
    padding: 40px 20px;
}

.modal-loading .spinner {
    margin: 0 auto 15px;
}

@media (max-width: 768px) {
    .search-form {
        flex-direction: column;
    }
    
    .search-form .btn {
        width: 100%;
    }
    
    .modal {
        max-height: 85vh;
    }
    
    .booking-detail-row {
        flex-wrap: wrap;
    }
    
    .booking-detail-row .label {
        min-width: 100%;
        margin-left: 38px;
    }
    
    .booking-detail-row .value {
        margin-left: 38px;
    }
}
