/* Define CSS Variables for easy theming */
:root {
    --primary-color: #0d6efd; /* Bootstrap primary color */
    --secondary-color: #6c757d; /* Bootstrap secondary color */
    --background-color: #f8f9fa; /* Light grey background */
    --text-color: #212529; /* Bootstrap body text color */
    --light-text-color: #6c757d; /* Bootstrap light text color */
    --border-color: #dee2e6; /* Bootstrap border color */
    --hover-color: #e9ecef; /* Hover background color */
    --font-family: 'Roboto', sans-serif; /* Roboto font */
}

/* General Styles */
body {
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden; /* Prevent body from scrolling */
}

/* Container Styles */
.container-fluid {
    height: 100%;
}

.row {
    height: 100%;
    margin: 0;
}

.col-lg-8,
.col-lg-4 {
    height: 100%;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.col-lg-8 {
    /* Left side: Calendar */
    overflow: hidden; /* Hide overflow to ensure only calendar body scrolls */
}

.col-lg-4 {
    /* Right side: Settings and Output Box */
    overflow-y: auto;
}

/* Calendar Container */
.calendar-container {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

/* Calendar Header */
.calendar-header {
    background-color: var(--background-color);
    border-bottom: 1px solid var(--border-color);
    z-index: 3;
}

/* Weekday Headers */
#calendar-header {
    display: grid;
    grid-template-columns: auto repeat(7, 1fr);
    position: sticky;
    top: 0;
    background-color: var(--background-color);
    z-index: 3;
}

/* Date Headers */
#calendar-dates {
    display: grid;
    grid-template-columns: auto repeat(7, 1fr);
    position: sticky;
    top: 40px; /* Adjust based on #calendar-header height */
    background-color: var(--background-color);
    z-index: 2;
    border-bottom: 1px solid var(--border-color);
}

/* Calendar Body */
.calendar-body {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Time Labels */
.time {
    position: sticky;
    left: 0;
    background-color: var(--background-color);
    z-index: 1;
    height: 15px;
    line-height: 15px;
    border-top: 1px solid transparent;
}

.time.hour-start {
    height: 16px; /* Increase height by 1px to account for the border */
    line-height: 15px;
    border-top: 1px solid var(--border-color);
}

/* Calendar Grid */
.calendar {
    display: grid;
    grid-template-columns: auto repeat(7, 1fr);
    border-collapse: collapse;
}

/* Header Cells */
.header,
.date-header,
.time,
.cell {
    background-color: #fff;
    text-align: center;
    font-size: 12px;
    box-sizing: border-box;
    padding: 0;
    margin: 0;
    border-right: 1px solid var(--border-color);
}

.header {
    font-weight: 500;
    padding: 10px;
    background-color: var(--background-color);
    border-bottom: 1px solid var(--border-color);
}

.date-header {
    font-weight: 500;
    padding: 5px;
    background-color: var(--background-color);
    border-bottom: 1px solid var(--border-color);
}

/* Calendar Cells */
.cell {
    height: 15px;
    cursor: pointer;
    border-top: none;
    box-sizing: border-box;
    padding: 0;
    margin: 0;
    transition: background-color 0.1s ease;
}

.cell:hover {
    background-color: var(--hover-color);
}

.selected:hover {
    background-color: #3a8eff; /* Light blue color for selected cell hover */
}

.cell:active,
.selected {
    background-color: var(--primary-color);
    color: #fff;
}

.hour-start {
    border-top: 1px solid var(--border-color);
}

.selected.hour-start {
    border-top-color: var(--primary-color);
}

/* Adjust the first cell of each hour */
.cell.hour-start {
    height: 16px; /* Increase height by 1px to account for the border */
}

/* Adjust border for the last column */
.header:last-child,
.date-header:last-child,
.cell:nth-child(8n),
.time {
    border-right: none;
}

/* Settings Container */
.settings-container {
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
}

/* Settings Content */
.settings-content {
    flex-grow: 1;
}

/* Output Box */
#availability-summary {
    width: 100%;
    height: 150px;  /* Increased from 100px to 150px */
    margin-bottom: 10px;
}

/* Style for the Clear All Times button */
#clear-all-times {
    background-color: #f0f0f0;
    border-color: #d0d0d0;
    color: #333;
    font-size: 0.85rem;
}

#clear-all-times:hover {
    background-color: #e0e0e0;
    border-color: #c0c0c0;
}

/* Style for the Copy to Clipboard button */
#copy-to-clipboard {
    background-color: #000080;
    border-color: #000060;
    color: #fff;
    font-size: 0.85rem;
}

#copy-to-clipboard:hover {
    background-color: #0000a0;
    border-color: #000080;
}

/* Adjust the size of both buttons */
#clear-all-times,
#copy-to-clipboard {
    padding: 0.375rem 0.75rem;
    font-size: 0.85rem;
}

/* Collapsible Sections */
.timezone-toggle,
.settings-toggle {
    margin-top: 20px;
}

.timezone-header,
.settings-header,
.calendar-integration-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 10px;
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    min-height: 45px;
}

.timezone-pane,
.settings-pane {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 5px 5px;
}

/* Logo and Instructions */
.logo-container {
    margin-top: auto;
    padding-top: 20px;
}

.instructions {
    font-size: 0.9rem;
    color: var(--light-text-color);
}

.logo-copyright {
    font-size: 0.8rem;
    color: var(--light-text-color);
    text-align: left;
    margin-top: 10px;
}

/* Scrollbar Styling */
.calendar-body::-webkit-scrollbar {
    width: 8px;
}

.calendar-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.calendar-body::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.calendar-body::-webkit-scrollbar-thumb:hover {
    background: #0a58ca;
}

/* Responsive Styles */
@media (max-width: 991px) {
    body {
        overflow: auto;
    }
    .row {
        flex-direction: column;
        height: auto;
    }
    .col-lg-8,
    .col-lg-4 {
        width: 100%;
        height: 50vh;
        overflow: auto;
    }
    .calendar-container {
        height: 100%;
    }
    .calendar-body {
        max-height: calc(50vh - 80px); /* Adjust based on header heights */
    }
    .settings-container {
        padding: 10px;
        height: 50vh;
    }
}

/* Update the logo title color */
.logo-title {
    font-family: 'Roboto', sans-serif;
    font-weight: 900;
    font-size: 1.2rem;
    color: #000080; /* Changed to dark navy */
    margin-bottom: 10px;
    text-transform: lowercase;
    letter-spacing: -1px;
}

/* Primary Timezone Row and Additional Timezone Rows */
.primary-timezone,
.timezone-row {
    display: flex;
    align-items: flex-end;
    margin-bottom: 10px;
}

.primary-timezone .col-9,
.timezone-row .col-9 {
    padding-right: 10px;  /* Increase space between select and input */
}

.primary-timezone .col-3,
.timezone-row .col-2 {
    padding-left: 0;  /* Remove left padding to align with increased right padding of previous column */
}

.primary-timezone label,
.timezone-row label {
    margin-bottom: 0.25rem;
}

.primary-timezone .form-select,
.primary-timezone .form-control,
.timezone-row .form-select,
.timezone-row .form-control {
    height: 38px;
}

.timezone-row .delete-timezone {
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 10px;  /* Add some space between input and delete button */
}

/* Star Rating */
.star-rating {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.star {
    font-size: 28px;
    cursor: pointer;
    transition: color 0.2s ease;
}

/* Feedback Modal */
.feedback-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.feedback-modal-content {
    position: relative;
    background-color: #fff;
    margin: 15% auto;
    padding: 20px;
    width: 80%;
    max-width: 500px;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
}

.close-modal:hover {
    color: #000;
}

#feedbackText {
    width: 100%;
    height: 150px;
    margin: 20px 0;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .feedback-modal-content {
        margin: 10% auto;
        width: 90%;
        padding: 15px;
    }
}

/* Feedback Container */
.feedback-container {
    text-align: left;
    margin-top: 10px;
    padding: 0;
}

.star-rating {
    display: flex;
    gap: 5px;
    justify-content: flex-start;
    margin-left: 20px;
}

.star {
    color: transparent;
    cursor: pointer;
    font-size: 18px;
    -webkit-text-stroke: 1px #ccc;
    transition: color 0.2s;
}

.star:hover,
.star.active {
    color: #ffd700;
    -webkit-text-stroke: 1px #ffd700;
}

.star:hover ~ .star {
    color: transparent;
    -webkit-text-stroke: 1px #ccc;
}

.star-rating:hover .star:hover,
.star-rating:hover .star:has(~ .star:hover) {
    color: #ffd700;
    -webkit-text-stroke: 1px #ffd700;
}

.feedback-thank-you {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #4CAF50;
    color: white;
    padding: 15px 25px;
    border-radius: 5px;
    z-index: 1001;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    animation: fadeIn 0.3s ease-in;
}

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

.cell.busy {
    background-color: rgba(255, 0, 0, 0.1);
}

.cell.busy.selected {
    background-color: rgba(0, 0, 255, 0.2);
}

.cell.busy:hover {
    background-color: rgba(255, 0, 0, 0.2);
}

.cell.busy.selected:hover {
    background-color: rgba(0, 0, 255, 0.3);
}

.calendar-integration-toggle {
    margin-top: 20px;
}

.calendar-integration-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 10px;
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 5px;
}

.calendar-integration-pane {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 5px 5px;
}

.calendar-legend {
    margin-left: 5px;
    margin: 10px 0;
    padding: 5px 0;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 5px 0;
}

.legend-color {
    width: 30px;
    height: 30px;
    background-color: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.2);
    border-radius: 4px;
}

.timezone-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.timezone-row .col-3 {
    display: flex;
    align-items: center;
}

.timezone-row .col-3 label {
    white-space: nowrap;
    margin-bottom: 0;
    margin-right: 8px;
}

.timezone-row .timezone-abbr {
    flex: 1;
}

.delete-timezone {
    color: #666;
    font-size: 20px;
    text-decoration: none;
    line-height: 1;
}

.delete-timezone:hover {
    color: #dc3545;
    text-decoration: none;
}

/* Add styles for the header titles */
.timezone-header h6,
.settings-header h6,
.calendar-integration-header h6 {
    margin: 0;
    line-height: 1;
}

/* Add these styles after the delete-timezone styles */
.swap-timezone {
    color: #666;
    font-size: 20px;
    text-decoration: none;
    line-height: 1;
    margin-right: 8px;  /* Space between swap and delete icons */
    display: none;  /* Hidden by default */
}

.swap-timezone:hover {
    color: var(--primary-color);
    text-decoration: none;
}

/* When exactly two timezones are present, show the swap icon */
.timezone-row:first-child + .timezone-row:last-child .swap-timezone {
    display: inline;
}

/* Update the timezone-row .col-3 to accommodate the new icon */
.timezone-row .col-3 {
    display: flex;
    align-items: center;
    gap: 8px;  /* Consistent spacing between elements */
}

.calendar-row {
    display: flex;
    align-items: center;
    margin: 2px 0;
    gap: 10px;
}

.signout-button {
    padding: 0px 8px;
    min-width: 30px;
    height: 30px;
    line-height: 1;
    font-size: 20px;
}

.calendar-legend {
    margin-left: 5px;
}

.cell.busy-1 { background-color: rgba(255, 192, 203, 0.3); }
.cell.busy-2 { background-color: rgba(255, 165, 0, 0.3); }
.cell.busy-3 { background-color: rgba(255, 0, 0, 0.3); }
.cell.busy-4 { background-color: rgba(255, 255, 0, 0.3); }
.cell.busy-5 { background-color: rgba(144, 238, 144, 0.3); }

.cell.busy-1:hover { background-color: rgba(255, 192, 203, 0.4); }
.cell.busy-2:hover { background-color: rgba(255, 165, 0, 0.4); }
.cell.busy-3:hover { background-color: rgba(255, 0, 0, 0.4); }
.cell.busy-4:hover { background-color: rgba(255, 255, 0, 0.4); }
.cell.busy-5:hover { background-color: rgba(144, 238, 144, 0.4); }

.legend-color-1 { background-color: rgba(255, 192, 203, 0.3); }
.legend-color-2 { background-color: rgba(255, 165, 0, 0.3); }
.legend-color-3 { background-color: rgba(255, 0, 0, 0.3); }
.legend-color-4 { background-color: rgba(255, 255, 0, 0.3); }
.legend-color-5 { background-color: rgba(144, 238, 144, 0.3); }

/* Selected cell style - add !important to ensure it takes precedence */
.cell.selected {
    background-color: rgba(0, 0, 128, 0.3) !important; /* Navy for free slots */
}

.cell.selected:hover {
    background-color: rgba(0, 0, 128, 0.4) !important;
}

/* Selected cell that overlaps with busy times */
.cell.selected[class*="busy-"] {
    background-color: rgba(0, 0, 128, 0.15) !important; /* Light navy for busy slots */
}

.cell.selected[class*="busy-"]:hover {
    background-color: rgba(0, 0, 128, 0.25) !important;
}

#refresh-calendars,
#add-calendar,
#clear-auth {
    padding: 0px 8px;
    min-width: 30px;
    height: 30px;
    line-height: 1;
    font-size: 14px;
    margin: 0;
}

.d-flex.gap-2.mt-2 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0 0 0;
}
