/**
 * Home Page Styles
 * Styles for the public-facing patient portal
 */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    min-height: 100vh;
}

/* Header */
.header {
    background: rgba(255,255,255,0.98);
    padding: 15px 30px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(0,0,0,0.1);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 2.2rem;
}

.logo h1 {
    font-size: 1.5rem;
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-nav {
    display: flex;
    gap: 8px;
    align-items: center;
}

.nav-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.nav-btn.outline {
    background: transparent;
    color: #0ea5e9;
    border: 2px solid #0ea5e9;
}

.nav-btn.outline:hover {
    background: #0ea5e9;
    color: white;
}

.nav-btn.primary {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: white;
}

.nav-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(14, 165, 233, 0.4);
}

/* Hero Section */
.hero {
    padding: 40px 30px 50px;
    text-align: center;
    color: white;
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.95;
    max-width: 600px;
    margin: 0 auto 30px;
}

/* Hero Features */
.hero-features {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
    margin-top: 30px;
}

.hero-feature {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-size: 0.95rem;
}

.hero-feature .icon {
    font-size: 1.5rem;
}

/* Main Container */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px 60px;
}

/* Tab Navigation */
.tab-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 40px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.tab-btn {
    padding: 20px;
    background: rgba(255,255,255,0.95);
    color: #374151;
    border: 2px solid transparent;
    border-radius: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    font-size: 0.95rem;
    text-align: center;
}

.tab-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    border-color: #0ea5e9;
}

.tab-btn.active {
    background: white;
    color: #0ea5e9;
    border-color: #0ea5e9;
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.3);
    transform: translateY(-5px);
}

.tab-icon {
    font-size: 2.5rem;
}

/* Section Card */
.section-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.15);
    display: none;
}

.section-card.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.section-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid #f3f4f6;
}

.section-icon {
    font-size: 2.5rem;
}

.section-title {
    font-size: 1.8rem;
    color: #1f2937;
}

.section-subtitle {
    color: #6b7280;
    font-size: 0.95rem;
    margin-top: 5px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.stat-box {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.stat-box.purple {
    background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
}

.stat-box.blue {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.stat-box.orange {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.stat-label {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
}

/* Form Styles */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #374151;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 14px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s;
    font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
}

.btn-submit {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
}

.btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Time Slots */
.time-slots-container {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #f3f4f6;
}

.time-slots-title {
    font-size: 1.1rem;
    color: #1f2937;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.time-slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
}

.time-slot {
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
}

.time-slot.available {
    background: #d1fae5;
    color: #065f46;
    border: 2px solid #10b981;
}

.time-slot.available:hover {
    background: #10b981;
    color: white;
    transform: scale(1.05);
}

.time-slot.booked {
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid #ef4444;
    cursor: not-allowed;
    opacity: 0.6;
}

.time-slot.last-slot {
    background: #fef3c7;
    color: #92400e;
    border: 2px solid #f59e0b;
}

.time-slot.last-slot:hover {
    background: #f59e0b;
    color: white;
}

.time-slot.selected {
    background: #0ea5e9;
    color: white;
    border-color: #0ea5e9;
}

/* Search Box */
.search-box {
    display: flex;
    gap: 12px;
}

.search-input {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
}

.search-input:focus {
    border-color: #14b8a6;
    box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.1);
}

.btn-search {
    padding: 16px 30px;
    background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-search:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(20, 184, 166, 0.3);
}

/* Result Box */
.result-box {
    margin-top: 30px;
    padding: 25px;
    background: #f9fafb;
    border-radius: 15px;
    display: none;
}

.result-box.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Appointment Card */
.appointment-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    border: 2px solid #e5e7eb;
    transition: all 0.3s;
}

.appointment-card:hover {
    border-color: #0ea5e9;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.appointment-card .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 0;
    box-shadow: none;
    position: static;
}

.appointment-card .date-time {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1f2937;
}

.appointment-card .status {
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status.pending { background: #fef3c7; color: #92400e; }
.status.confirmed { background: #d1fae5; color: #065f46; }
.status.completed { background: #dbeafe; color: #1e40af; }
.status.cancelled { background: #fee2e2; color: #991b1b; }

.appointment-card .details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    color: #6b7280;
    font-size: 0.95rem;
}

.appointment-card .actions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 10px;
}

.btn-action {
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
}

.btn-action.cancel {
    background: #fee2e2;
    color: #dc2626;
}

.btn-action.cancel:hover {
    background: #dc2626;
    color: white;
}

.btn-action.reschedule {
    background: #dbeafe;
    color: #1d4ed8;
}

.btn-action.reschedule:hover {
    background: #1d4ed8;
    color: white;
}

/* Info Box */
.info-box {
    margin-top: 25px;
    padding: 20px;
    border-radius: 12px;
}

.info-box h4 {
    color: #92400e;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-box ul {
    margin: 0;
    padding-left: 20px;
    color: #92400e;
    line-height: 1.8;
}

/* Clinic Info Section */
.clinic-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.clinic-info-card {
    background: #f9fafb;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s;
}

.clinic-info-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.clinic-info-card .icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.clinic-info-card h3 {
    color: #1f2937;
    margin-bottom: 10px;
}

.clinic-info-card p {
    color: #6b7280;
    line-height: 1.6;
}

.clinic-info-card a {
    color: #0ea5e9;
    text-decoration: none;
    font-weight: 600;
}

.clinic-info-card a:hover {
    text-decoration: underline;
}

/* Working hours sessions styling */
.clinic-info-card .working-hours-session {
    border-radius: 8px;
    font-size: 0.95rem;
}

.clinic-info-card .working-hours-session strong {
    color: #0ea5e9;
    display: inline-block;
    min-width: 55px;
}

/* Google Map iframe responsive */
.clinic-info-grid + div iframe {
    width: 100%;
    height: 400px;
    border: 0;
}

/* Message */
.message {
    padding: 15px 20px;
    border-radius: 10px;
    margin-top: 20px;
    display: none;
    align-items: center;
    gap: 10px;
}

.message.show {
    display: flex;
}

.message.success {
    background: #d1fae5;
    color: #065f46;
    border: 2px solid #10b981;
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid #ef4444;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: #6b7280;
    display: none;
}

.loading.show {
    display: block;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e5e7eb;
    border-top-color: #0ea5e9;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

/* Empty State */
.empty-state {
    grid-column: 1 / -1; /* Span toàn bộ grid columns */
    text-align: center;
    padding: 50px 30px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 16px;
    border: 2px dashed #f59e0b;
    margin: 20px 0;
    animation: fadeIn 0.5s ease-in;
    min-height: auto; /* Override grid height */
}

.empty-state .icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: swing 2s ease-in-out infinite;
    display: inline-block;
}

.empty-state p {
    font-size: 1.2rem;
    font-weight: 600;
    color: #92400e;
    margin: 0 0 10px 0;
    line-height: 1.6;
}

.empty-state small {
    font-size: 1rem;
    color: #b45309;
    font-weight: 500;
    display: block;
    margin-top: 10px;
}

@keyframes swing {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

/* Footer */
.footer {
    background: rgba(0,0,0,0.2);
    color: white;
    text-align: center;
    padding: 30px;
    margin-top: 60px;
}

.footer p {
    opacity: 0.9;
    margin-bottom: 10px;
}

.footer a {
    color: white;
    text-decoration: underline;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid #f3f4f6;
}

.modal-header h3 {
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: #f3f4f6;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.3s;
}

.modal-close:hover {
    background: #e5e7eb;
    color: #1f2937;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    background: #f9fafb;
    border-radius: 0 0 20px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Two Column Layout */
.two-col-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 0;
}

.two-col-card {
    display: block !important;
    animation: none !important;
}

/* Prescription Lookup Modal */
.lookup-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1100;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
}

.lookup-modal.show {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.lookup-modal-content {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 560px;
    max-height: 88vh;
    overflow-y: auto;
    animation: modalSlide 0.25s ease;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
}

.lookup-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 2px solid #f3f4f6;
    position: sticky;
    top: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    z-index: 1;
}

.lookup-modal-header h3 {
    color: #14b8a6;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lookup-modal-close {
    background: #f3f4f6;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lookup-modal-close:hover {
    background: #e5e7eb;
    color: #1f2937;
}

.lookup-modal-body {
    padding: 20px 24px 24px;
}

/* Responsive */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .clinic-info-grid {
        grid-template-columns: 1fr;
    }

    .two-col-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    .header-nav {
        width: 100%;
        justify-content: center;
    }

    .hero h2 {
        font-size: 1.8rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .hero-features {
        gap: 20px;
    }

    .hero-feature {
        font-size: 0.85rem;
    }

    .hero-feature .icon {
        font-size: 1.3rem;
    }

    .tab-nav {
        grid-template-columns: 1fr 1fr;
    }

    .tab-btn {
        padding: 15px 10px;
    }

    .tab-btn small {
        display: none;
    }

    .tab-icon {
        font-size: 2rem;
    }

    .section-card {
        padding: 25px;
    }

    .search-box {
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .appointment-card .details {
        grid-template-columns: 1fr;
    }

    .two-col-layout {
        grid-template-columns: 1fr;
    }
}
