/* ===================================
   Global Styles & Reset
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3498db;
    --primary-dark: #2980b9;
    --secondary-color: #95a5a6;
    --success-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --dark: #2c3e50;
    --light: #ecf0f1;
    --white: #ffffff;
    --gray: #7f8c8d;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

/* ===================================
   Header & Footer
   =================================== */
header {
    background: var(--dark);
    color: var(--white);
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header p {
    color: var(--light);
    font-size: 1.1rem;
}

footer {
    background: var(--light);
    padding: 20px;
    text-align: center;
    color: var(--gray);
    font-size: 0.9rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    margin-left: 10px;
}

footer a:hover {
    text-decoration: underline;
}

/* ===================================
   Buttons
   =================================== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--white);
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-success {
    background: var(--success-color);
    color: var(--white);
}

.btn-danger {
    background: var(--danger-color);
    color: var(--white);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-block {
    width: 100%;
}

.btn-nav {
    background: transparent;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--primary-color);
    padding: 5px 15px;
    transition: var(--transition);
}

.btn-nav:hover {
    color: var(--primary-dark);
    transform: scale(1.2);
}

/* ===================================
   Forms
   =================================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--light);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

.time-range {
    display: flex;
    align-items: center;
    gap: 10px;
}

.time-range input {
    flex: 1;
}

.inline-form {
    background: var(--light);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

/* ===================================
   Booking Container
   =================================== */
.booking-container {
    padding: 40px;
}

.booking-step {
    display: none;
}

.booking-step.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.booking-step h2 {
    margin-bottom: 25px;
    color: var(--dark);
    font-size: 1.8rem;
}

.step-actions {
    margin-top: 30px;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

/* ===================================
   Appointment Types Grid
   =================================== */
.type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.type-card {
    border: 3px solid var(--light);
    border-radius: var(--border-radius);
    padding: 25px;
    cursor: pointer;
    transition: var(--transition);
    background: var(--white);
    position: relative;
}

.type-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow);
}

.type-card.selected {
    border-color: var(--primary-color);
    background: rgba(52, 152, 219, 0.05);
}

.type-card h3 {
    margin-bottom: 10px;
    color: var(--dark);
}

.type-card p {
    color: var(--gray);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.type-duration {
    display: inline-block;
    background: var(--light);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--dark);
    font-weight: 600;
}

/* ===================================
   Calendar
   =================================== */
.calendar-container {
    max-width: 600px;
    margin: 0 auto;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-header h3 {
    font-size: 1.5rem;
    color: var(--dark);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
}

.calendar-day-header {
    text-align: center;
    font-weight: 600;
    color: var(--gray);
    padding: 10px;
    font-size: 0.9rem;
}

.calendar-day {
    aspect-ratio: 1;
    border: 2px solid var(--light);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    background: var(--white);
}

.calendar-day:hover:not(.disabled):not(.other-month) {
    background: var(--light);
    transform: scale(1.05);
}

.calendar-day.selected {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.calendar-day.today {
    border-color: var(--primary-color);
    font-weight: 700;
}

.calendar-day.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: #f9f9f9;
}

.calendar-day.other-month {
    opacity: 0.3;
    cursor: default;
}

/* ===================================
   Time Slots
   =================================== */
.time-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.time-slot {
    padding: 15px;
    border: 2px solid var(--light);
    border-radius: var(--border-radius);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    background: var(--white);
}

.time-slot:hover {
    background: var(--light);
    transform: translateY(-3px);
}

.time-slot.selected {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.info-box {
    background: var(--light);
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    border-left: 4px solid var(--primary-color);
}

/* ===================================
   Booking Summary
   =================================== */
.booking-summary {
    background: var(--light);
    padding: 25px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
}

.booking-summary h3 {
    margin-bottom: 15px;
    color: var(--dark);
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #ddd;
}

.summary-item:last-child {
    border-bottom: none;
}

.summary-label {
    font-weight: 600;
    color: var(--gray);
}

.summary-value {
    color: var(--dark);
    font-weight: 600;
}

/* ===================================
   Success Message
   =================================== */
.success-message {
    text-align: center;
    padding: 60px 20px;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: var(--success-color);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin: 0 auto 30px;
    animation: successPulse 0.5s ease-in-out;
}

@keyframes successPulse {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.success-message h2 {
    color: var(--success-color);
    margin-bottom: 20px;
}

.confirmation-note {
    color: var(--gray);
    margin: 20px 0;
}

#confirmation-details {
    background: var(--light);
    padding: 20px;
    border-radius: var(--border-radius);
    margin: 20px auto;
    max-width: 500px;
}

/* ===================================
   Admin Styles
   =================================== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-box {
    background: var(--white);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--dark);
}

.login-footer {
    margin-top: 20px;
    text-align: center;
}

.admin-container {
    background: var(--white);
}

.admin-header {
    background: var(--dark);
    color: var(--white);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-header h1 {
    font-size: 1.8rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.admin-nav {
    background: var(--light);
    padding: 0;
    display: flex;
    border-bottom: 2px solid #ddd;
}

.nav-tab {
    padding: 15px 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray);
    border-bottom: 3px solid transparent;
    transition: var(--transition);
}

.nav-tab:hover {
    background: rgba(0, 0, 0, 0.05);
}

.nav-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.admin-main {
    padding: 30px;
}

.admin-tab {
    display: none;
}

.admin-tab.active {
    display: block;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.tab-header h2 {
    color: var(--dark);
}

/* ===================================
   Appointments List
   =================================== */
.filter-group {
    display: flex;
    gap: 10px;
}

.filter-btn {
    padding: 8px 16px;
    background: var(--light);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.filter-btn:hover {
    background: #ddd;
}

.filter-btn.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.appointments-list {
    display: grid;
    gap: 15px;
}

.appointment-card {
    border: 2px solid var(--light);
    border-radius: var(--border-radius);
    padding: 20px;
    background: var(--white);
    transition: var(--transition);
    border-left: 5px solid var(--primary-color);
}

.appointment-card:hover {
    box-shadow: var(--box-shadow);
}

.appointment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.appointment-header h4 {
    color: var(--dark);
    font-size: 1.2rem;
}

.appointment-status {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-pending {
    background: #ffeaa7;
    color: #d63031;
}

.status-confirmed {
    background: #55efc4;
    color: #00b894;
}

.status-cancelled {
    background: #fab1a0;
    color: #d63031;
}

.status-completed {
    background: #a29bfe;
    color: #6c5ce7;
}

.appointment-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.detail-item {
    font-size: 0.9rem;
}

.detail-label {
    color: var(--gray);
    font-weight: 600;
    display: block;
    margin-bottom: 5px;
}

.appointment-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--light);
}

.appointment-actions .btn {
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* ===================================
   Availability Sections
   =================================== */
.availability-sections {
    display: grid;
    gap: 30px;
}

.card {
    border: 2px solid var(--light);
    border-radius: var(--border-radius);
    padding: 25px;
    background: var(--white);
}

.card h3 {
    margin-bottom: 10px;
    color: var(--dark);
}

.card-description {
    color: var(--gray);
    margin-bottom: 20px;
}

#weekly-schedule {
    display: grid;
    gap: 15px;
    margin-bottom: 20px;
}

.schedule-day {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--light);
    border-radius: var(--border-radius);
}

.day-name {
    font-weight: 600;
    min-width: 100px;
}

.day-slots {
    flex: 1;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.slot-tag {
    background: var(--white);
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #ddd;
}

.slot-remove {
    background: var(--danger-color);
    color: var(--white);
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.exceptions-list {
    display: grid;
    gap: 10px;
}

.exception-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--light);
    border-radius: var(--border-radius);
}

.exception-blocked {
    background: #ffe4e4;
}

/* ===================================
   Types List
   =================================== */
.types-list {
    display: grid;
    gap: 15px;
}

.type-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border: 2px solid var(--light);
    border-radius: var(--border-radius);
    border-left: 5px solid var(--primary-color);
}

.type-info h4 {
    margin-bottom: 5px;
}

.type-info p {
    color: var(--gray);
    font-size: 0.9rem;
}

.type-actions {
    display: flex;
    gap: 10px;
}

.type-actions .btn {
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* ===================================
   Modal
   =================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 2px solid var(--light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--gray);
    line-height: 1;
}

.modal-close:hover {
    color: var(--dark);
}

.modal form {
    padding: 25px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ===================================
   Loading Overlay
   =================================== */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--white);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===================================
   Error Messages
   =================================== */
.error-message {
    background: #ffe4e4;
    color: var(--danger-color);
    padding: 12px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    display: none;
}

.error-message.active {
    display: block;
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 2rem;
    }

    .booking-container,
    .admin-main {
        padding: 20px;
    }

    .type-grid {
        grid-template-columns: 1fr;
    }

    .calendar-grid {
        gap: 5px;
    }

    .time-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .form-row {
        flex-direction: column;
    }

    .form-row .form-group {
        width: 100%;
    }

    .admin-nav {
        flex-direction: column;
    }

    .tab-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .appointment-details {
        grid-template-columns: 1fr;
    }

    .schedule-day {
        flex-direction: column;
        align-items: flex-start;
    }

    .day-slots {
        margin-top: 10px;
    }
}
