/* Bootstrap Primary Color Override */
:root {
    --bs-primary: #4e9e8b;
    --bs-primary-rgb: 78, 158, 139;
}

.btn-primary {
    background-color: #4e9e8b !important;
    border-color: #4e9e8b !important;
}

.btn-primary:hover {
    background-color: #3d7d6f !important;
    border-color: #3d7d6f !important;
}

.bg-primary {
    background-color: #4e9e8b !important;
}

.text-primary {
    color: #4e9e8b !important;
}

.border-primary {
    border-color: #4e9e8b !important;
}

/* General Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    padding: 0;
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
    overflow-y: auto;
}

.sidebar .nav-link {
    font-weight: 500;
    color: #333;
    padding: 12px 20px;
    margin: 5px 10px;
    border-radius: 5px;
    transition: all 0.3s;
}

.sidebar .nav-link:hover {
    background-color: #e9ecef;
    color: #4e9e8b;
}

.sidebar .nav-link.active {
    background-color: #4e9e8b;
    color: white;
}

.sidebar .nav-link i {
    margin-right: 8px;
}

/* Main Content */
main {
    padding-top: 20px;
}

/* Card Styles */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card-header {
    background-color: #fff;
    border-bottom: 2px solid #f0f0f0;
    font-weight: 600;
    padding: 15px 20px;
}

/* Appointment Card */
.appointment-card {
    border-left: 4px solid #4e9e8b;
    margin-bottom: 15px;
    transition: transform 0.2s;
}

.appointment-card:hover {
    transform: translateX(5px);
}

/* Button Styles */
.btn {
    border-radius: 5px;
    padding: 8px 16px;
    font-weight: 500;
    transition: all 0.3s;
}

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

/* Form Styles */
.form-control,
.form-select {
    border-radius: 5px;
    border: 1px solid #ced4da;
    padding: 10px 12px;
}

.form-control:focus,
.form-select:focus {
    border-color: #4e9e8b;
    box-shadow: 0 0 0 0.2rem rgba(78, 158, 139, 0.25);
}

/* Calendar Container */
#calendar-container {
    background-color: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.calendar-widget {
    background: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* FullCalendar Custom Styling */
.fc {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Interactive Calendar Container */
.interactive-calendar {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Clickable Event Slots */
.fc-event {
    cursor: pointer !important;
    transition: all 0.2s ease;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    padding: 4px 6px;
}

.fc-event:hover {
    opacity: 0.85 !important;
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.fc-daygrid-event {
    padding: 4px 6px;
    margin: 3px 1px;
}

.fc-timegrid-event {
    border-radius: 6px;
}

.fc-toolbar-title {
    font-size: 1.5em !important;
    font-weight: 600;
    color: #333;
}

.fc-button {
    background-color: #4e9e8b !important;
    border-color: #4e9e8b !important;
    text-transform: capitalize;
}

.fc-button:hover {
    background-color: #3d7d6f !important;
    border-color: #3d7d6f !important;
}

.fc-button-active {
    background-color: #3d7d6f !important;
}

.fc-today-button {
    background-color: #28a745 !important;
    border-color: #28a745 !important;
}

.fc-today-button:hover {
    background-color: #218838 !important;
    border-color: #218838 !important;
}

.fc .fc-daygrid-day.fc-day-today {
    background-color: #e7f3ff !important;
}

/* Google Calendar Embed */
.google-calendar-embed {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.google-calendar-embed iframe {
    display: block;
}

/* Time Slot Buttons for Google Calendar */
.time-slot-btn {
    min-width: 100px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.time-slot-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

#time-slots-list {
    background-color: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
}

#available-times h6 {
    margin-bottom: 10px;
    font-weight: 600;
}

/* Time Slot Buttons (Legacy) */
.time-slot {
    display: inline-block;
    padding: 10px 20px;
    margin: 5px;
    border: 2px solid #4e9e8b;
    border-radius: 5px;
    background-color: white;
    color: #4e9e8b;
    cursor: pointer;
    transition: all 0.3s;
}

.time-slot:hover {
    background-color: #4e9e8b;
    color: white;
}

.time-slot.selected {
    background-color: #4e9e8b;
    color: white;
}

.time-slot.disabled {
    border-color: #ccc;
    color: #ccc;
    cursor: not-allowed;
}

.time-slot.disabled:hover {
    background-color: white;
    color: #ccc;
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* Alert Styles */
.alert {
    border-radius: 10px;
    border: none;
    padding: 15px 20px;
}

.alert i {
    margin-right: 8px;
}

/* Profile Image */
.profile-img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid #4e9e8b;
}

/* Product Card */
.product-card {
    transition: transform 0.3s;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

/* Bank Info Card */
.bank-info-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    padding: 20px;
}

/* Status Badges */
.status-badge {
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
}

.status-waiting {
    background-color: #ffc107;
    color: #000;
}

.status-success {
    background-color: #28a745;
    color: #fff;
}

.status-error {
    background-color: #dc3545;
    color: #fff;
}

/* Custom Slot Picker Styles - Date Selector First */
/* iOS Safari Compatible - No visibility:hidden or height:0 tricks */
.date-selector-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    /* Force hardware acceleration for smooth scrolling on iOS */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.date-selector-header {
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

/* Calendar and slots layout container */
#calendar-container {
    display: none;
}

#calendar-container.active {
    display: block;
}

/* Desktop: side-by-side layout */
@media (min-width: 768px) {
    .booking-layout {
        display: grid;
        grid-template-columns: 400px 1fr;
        gap: 20px;
        align-items: start;
    }

    .change-booking-layout {
        display: grid;
        grid-template-columns: 320px 1fr;
        gap: 15px;
        align-items: start;
    }
}

/* Mobile: stacked layout */
@media (max-width: 767px) {
    .booking-layout {
        display: block;
    }

    .change-booking-layout {
        display: block;
    }

    .change-booking-layout .calendar-picker {
        margin-bottom: 15px;
    }
}

/* Calendar picker - 7 columns like traditional calendar */
.calendar-picker {
    background: white;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 5px;
}

.calendar-month {
    font-size: 1em;
    font-weight: 600;
    color: #333;
}

.calendar-nav-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.1em;
    color: #495057;
}

.calendar-nav-btn:hover {
    background: #e9ecef;
    border-color: #4e9e8b;
    color: #4e9e8b;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    margin-bottom: 3px;
}

.calendar-weekday {
    text-align: center;
    font-size: 0.75em;
    font-weight: 600;
    color: #6c757d;
    padding: 5px 0;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.calendar-day {
    aspect-ratio: 1;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85em;
    font-weight: 500;
    color: #adb5bd;
    cursor: not-allowed;
    transition: all 0.2s ease;
    min-height: 38px;
    /* iOS Safari fixes */
    -webkit-tap-highlight-color: rgba(78, 158, 139, 0.1);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.calendar-day.available {
    background: white;
    border-color: #495057;
    color: #000000;
    cursor: pointer;
    font-weight: 600;
}

.calendar-day.available:hover {
    background: #f8f9fa;
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.calendar-day.active {
    background: #4e9e8b;
    border-color: #4e9e8b;
    color: white;
    font-weight: 700;
}

.calendar-day.has-selection {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
    font-weight: 700;
}

.calendar-day.has-selection:hover {
    background: #c3e6cb;
}

.calendar-day.other-month {
    opacity: 0.3;
}

.calendar-day.today {
    border-color: #4e9e8b;
    border-width: 3px;
}

.calendar-day.has-appointment {
    position: relative;
    background: #e7f3ff;
    border-color: #0056b3;
    color: #003d82;
    font-weight: 600;
}

.calendar-day.has-appointment::after {
    content: '•';
    position: absolute;
    top: 2px;
    right: 4px;
    color: #007bff;
    font-size: 1.2em;
    font-weight: bold;
}

.calendar-day.has-appointment:hover {
    background: #d3e7f9;
}

.calendar-day.has-appointment.has-selection {
    background: linear-gradient(135deg, #d4edda 0%, #e7f3ff 100%);
    border-color: #28a745;
}

.calendar-day.has-appointment.has-selection::after {
    color: #28a745;
}

/* Mobile calendar adjustments */
@media (max-width: 767px) {
    .calendar-picker {
        padding: 8px;
        margin-bottom: 15px;
        max-width: 100%;
        overflow: hidden;
    }

    .calendar-header {
        margin-bottom: 8px;
        padding: 2px;
    }

    .calendar-month {
        font-size: 0.85em;
    }

    .calendar-nav-btn {
        width: 28px;
        height: 28px;
        font-size: 1em;
    }

    .calendar-weekday {
        font-size: 0.65em;
        padding: 3px 0;
    }

    .calendar-day {
        font-size: 0.75em;
        min-height: 28px;
        border-width: 1px;
        border-radius: 4px;
    }

    .calendar-day.available {
        border-width: 2px;
    }

    .calendar-day.today {
        border-width: 2px;
    }

    .calendar-days {
        gap: 2px;
    }

    .calendar-weekdays {
        gap: 2px;
    }
}

/* Extra small phones */
@media (max-width: 380px) {
    .calendar-picker {
        padding: 6px;
    }

    .calendar-month {
        font-size: 0.8em;
    }

    .calendar-nav-btn {
        width: 26px;
        height: 26px;
        font-size: 0.95em;
    }

    .calendar-weekday {
        font-size: 0.6em;
        padding: 2px 0;
    }

    .calendar-day {
        font-size: 0.7em;
        min-height: 26px;
    }

    .calendar-days {
        gap: 1px;
    }

    .calendar-weekdays {
        gap: 1px;
    }
}

/* Appointment Info Box */
.appointment-info-box {
    background: transparent;
    padding: 0;
    margin-bottom: 15px;
}

.appointment-info-item {
    padding: 8px 12px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #17a2b8;
    display: flex;
    align-items: center;
    gap: 10px;
}

.appointment-info-item i {
    font-size: 1.2em;
}

.appointment-info-item:last-child {
    margin-bottom: 0;
}

.time-slots-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: none;
}

@media (max-width: 767px) {
    .time-slots-container {
        padding: 15px;
    }
}

.time-slots-header {
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.time-slots-header i {
    color: #28a745;
}

.slot-picker-grid,
.time-slots-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
}

.slot-button {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 1em;
    font-weight: 500;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* iOS Safari fixes */
    -webkit-tap-highlight-color: rgba(78, 158, 139, 0.1);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.slot-button:hover {
    background: #e9ecef;
    border-color: #4e9e8b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(78, 158, 139, 0.2);
}

.slot-button:active {
    transform: translateY(0);
}

.slot-button.selected {
    background: #28a745;
    border-color: #28a745;
    color: white;
    font-weight: 600;
}

.slot-button.selected:hover {
    background: #218838;
    border-color: #1e7e34;
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.slot-button:disabled {
    background: #e9ecef;
    border-color: #dee2e6;
    color: #adb5bd;
    cursor: not-allowed;
    opacity: 0.6;
}

.slot-button:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Desktop - more columns for slots */
@media (min-width: 768px) {
    .slot-picker-grid,
    .time-slots-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

@media (min-width: 1200px) {
    .slot-picker-grid,
    .time-slots-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
}

/* Mobile specific adjustments for slots */
@media (max-width: 767px) {
    .slot-picker-grid,
    .time-slots-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .slot-button {
        padding: 10px 8px;
        font-size: 0.9em;
        min-height: 44px;
    }

    .date-selector-container,
    .time-slots-container {
        padding: 15px;
    }

    .date-selector-header,
    .time-slots-header {
        font-size: 1em;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: relative;
        height: auto;
    }

    main {
        padding-top: 10px;
    }

    .appointment-card {
        border-left: none;
        border-top: 4px solid #4e9e8b;
    }

    /* Make calendar responsive on mobile */
    .interactive-calendar {
        padding: 10px;
        overflow-x: auto;
    }

    /* Adjust FullCalendar for mobile */
    .fc-toolbar {
        flex-direction: column;
        gap: 10px;
    }

    .fc-toolbar-title {
        font-size: 1.1em !important;
    }

    .fc-button {
        font-size: 0.85em;
        padding: 0.3em 0.5em;
    }

    /* Make time grid more readable on mobile */
    .fc-timegrid-slot-label {
        font-size: 0.75em;
    }

    .fc-timegrid-event {
        font-size: 0.7em;
    }

    /* Reduce calendar height on mobile */
    .fc .fc-view-harness {
        max-height: 500px;
    }

    /* Adjust day header on mobile */
    .fc-col-header-cell {
        font-size: 0.75em;
        padding: 5px 2px;
    }

    /* Make event content smaller on mobile */
    .fc-event {
        font-size: 0.7em !important;
        padding: 2px 3px !important;
    }
}

/* Extra small screens */
@media (max-width: 576px) {
    .interactive-calendar {
        padding: 5px;
    }

    .fc-toolbar-title {
        font-size: 0.95em !important;
    }

    .fc-button {
        font-size: 0.75em;
        padding: 0.25em 0.4em;
    }

    /* Switch to single day view on very small screens */
    .fc-timeGridWeek-view .fc-timegrid-axis,
    .fc-timeGridWeek-view .fc-timegrid-slot-label {
        font-size: 0.65em;
    }

    /* Make calendar container scrollable horizontally */
    #booking-calendar,
    #first-meeting-calendar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Reduce event padding even more */
    .fc-event {
        font-size: 0.6em !important;
        padding: 1px 2px !important;
    }
}

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

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

/* Tab Content */
.tab-content {
    animation: fadeIn 0.3s ease-in;
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}
