/* New PreferencesPoll Page Styles */

.new-preferencesPoll-container {
    max-width: 1200px;
    margin: 0 auto;
}

.section-header {
    display: flex;
    align-items: center;
    padding-bottom: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.section-header h5 {
    margin: 0;
    color: #495057;
    font-weight: 600;
}

.section-header i {
    margin-right: 10px;
    color: #007bff;
    font-size: 1.1em;
}

/* Calendar Styles */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.calendar-day-header {
    text-align: center;
    font-weight: bold;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.calendar-day {
    text-align: center;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
    min-height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-day:hover:not(.past) {
    background: #e7f3ff;
    border-color: #007bff;
}

.calendar-day.selected {
    background: #007bff;
    color: white;
    border-color: #0056b3;
    font-weight: bold;
}

.calendar-day.past {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f8f9fa;
}


/* Timeline Selector */
.timeline-selector-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
}

.timeline-header {
    font-size: 0.875rem;
    color: #6c757d;
}

.timeline-wrapper {
    position: relative;
    width: 100%;
    margin-top: 30px;
}

.timeline-slots {
    width: 100%;
    background: white;
    position: relative;
}

.timeline-row-group {
    margin-bottom: 8px;
}

.timeline-row-group:last-child {
    margin-bottom: 0;
}

.timeline-hours-row {
    display: flex;
    width: 100%;
    margin-bottom: 0px; /* Remove gap between hours and slots */
    border: 1px solid #dee2e6;
    border-bottom: none; /* Connect to slots row below */
    border-radius: 4px 4px 0 0; /* Rounded top corners only */
    background: #f8f9fa;
}

.timeline-hour-label {
    flex: 2; /* Take space of 2 slots (1 hour = 2 slots of 30min each) */
    text-align: center;
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: 500;
    padding: 4px 2px;
    border-right: 1px solid #dee2e6;
    background: #f8f9fa;
}

.timeline-hour-label:last-child {
    border-right: none;
}

.timeline-slots-row {
    display: flex;
    width: 100%;
    border: 1px solid #dee2e6;
    border-top: none; /* Connect to hours row above */
    border-radius: 0 0 4px 4px; /* Rounded bottom corners only */
    overflow: hidden;
}

.timeline-slot {
    flex: 1; /* Fill the row equally */
    height: 50px;
    border-right: 1px solid #e9ecef;
    cursor: pointer;
    position: relative;
    min-width: 20px; /* Minimum width for very small screens */
}


.timeline-slot:hover {
    background: #e7f3ff;
    border-color: #007bff;
    z-index: 2;
}

.timeline-slot:last-child {
    border-right: none;
}

.timeline-slot.in-range {
    border-color: #007bff;
    position: relative;
    /* Background will be set dynamically via JS for precise time ranges */
}

.timeline-slot.in-range:hover {
    border-color: #dc3545 !important;
    cursor: pointer;
    opacity: 0.7;
    /* Background gradient is preserved, just dimmed */
}

.timeline-slot.in-range:hover::after {
    content: '×';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #dc3545;
    font-weight: bold;
    font-size: 16px;
    pointer-events: none;
    z-index: 5;
}


.timeline-slots-row.selecting .timeline-slot.selected {
    background: #0d6efd !important;
    border: 2px solid #0a58ca !important;
    color: white;
    z-index: 10;
    position: relative;
}

.timeline-slot.selecting-range {
    background: #0d6efd;
}

/* Time Blocks */
.time-blocks-container {
    margin-bottom: 15px;
}

.time-block-item {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #007bff;
    margin-bottom: 10px;
}

/* Apply to All Button */
.apply-to-all-dates-btn {
    font-size: 0.75rem;
    padding: 4px 8px;
}

.apply-to-all-dates-btn:hover {
    background-color: #198754;
    border-color: #198754;
    color: white;
}

.apply-to-all-dates-btn i {
    font-size: 0.7rem;
}

/* Availability Blocks Display */
.availability-blocks {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 12px;
    border: 1px solid #e9ecef;
}

.availability-block-item {
    display: inline-block;
    background: #e7f3ff;
    border: 1px solid #007bff;
    border-radius: 4px;
    padding: 4px 8px;
    margin: 2px 4px 2px 0;
    font-size: 0.875rem;
    color: #0056b3;
}

.availability-block-item i {
    font-size: 0.75rem;
    margin-right: 4px;
}

.availability-block-item small {
    font-size: 0.75rem;
    margin-left: 4px;
}

/* Required field validation styles */
.form-control.field-required-empty {
    border-color: #dc3545 !important;
    border-width: 2px !important;
}

.form-control.field-required-empty::placeholder {
    color: #dc3545 !important;
    opacity: 1 !important;
    font-weight: 500;
}

.form-control.field-required-empty:focus {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

    .form-control.field-error,
textarea.form-control.field-error {
    border-color: #dc3545 !important;
    border-width: 2px !important;
}

.form-control.field-error:focus,
textarea.form-control.field-error:focus {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

/* Conflict Visualization Styles */
.timeline-slot.conflict-finalized {
    background: repeating-linear-gradient(
        45deg,
        rgba(108, 117, 125, 0.3),
        rgba(108, 117, 125, 0.3) 10px,
        rgba(255, 255, 255, 0.3) 10px,
        rgba(255, 255, 255, 0.3) 20px
    ) !important;
    cursor: not-allowed !important;
    opacity: 0.6;
    position: relative;
    pointer-events: none;
}

.timeline-slot.conflict-finalized::before {
    content: '🔒';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 10px;
    z-index: 3;
    pointer-events: none;
}

.timeline-slot.conflict-active-poll {
    border: 2px solid #ffc107 !important;
    background: rgba(255, 193, 7, 0.15) !important;
    position: relative;
}

.timeline-slot.conflict-active-poll::before {
    content: '📅';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 10px;
    z-index: 3;
    pointer-events: none;
}

.timeline-slot.conflict-pending-invite {
    border: 2px solid #0dcaf0 !important;
    background: rgba(13, 202, 240, 0.15) !important;
    position: relative;
}

.timeline-slot.conflict-pending-invite::before {
    content: '✉️';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 10px;
    z-index: 3;
    pointer-events: none;
}

/* Conflict Visibility Controls */
.conflict-visibility-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 10px;
}

.conflict-visibility-controls .form-check {
    margin: 0;
}

.conflict-visibility-controls .form-check-label {
    font-size: 0.875rem;
    color: #495057;
    cursor: pointer;
}

/* Conflict Legend */
.conflict-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-top: 10px;
}

.conflict-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #6c757d;
}

.conflict-legend-item.finalized {
    color: #6c757d;
}

.conflict-legend-item.active {
    color: #856404;
}

.conflict-legend-item.pending {
    color: #055160;
}

.conflict-legend-item i,
.conflict-legend-item span:first-child {
    font-size: 12px;
}

/* Ensure conflict styles override selection styles */
.timeline-slot.conflict-finalized.in-range {
    background: repeating-linear-gradient(
        45deg,
        rgba(108, 117, 125, 0.3),
        rgba(108, 117, 125, 0.3) 10px,
        rgba(255, 255, 255, 0.3) 10px,
        rgba(255, 255, 255, 0.3) 20px
    ) !important;
}

.timeline-slot.conflict-active-poll.in-range {
    background: linear-gradient(
        to right,
        rgba(255, 193, 7, 0.15) 0%,
        rgba(0, 123, 255, 0.3) 50%,
        rgba(255, 193, 7, 0.15) 100%
    ) !important;
}

.timeline-slot.conflict-pending-invite.in-range {
    background: linear-gradient(
        to right,
        rgba(13, 202, 240, 0.15) 0%,
        rgba(0, 123, 255, 0.3) 50%,
        rgba(13, 202, 240, 0.15) 100%
    ) !important;
}

.invalid-feedback.d-block {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.invalid-feedback.d-block i {
    margin-right: 0.25rem;
}

/* Field error styling */
#preferencesPollDescription.field-error,
#preferencesPollTitle.field-error,
#locationAddress.field-error {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

#requiredFieldsMessage {
    position: sticky;
    top: 20px;
    z-index: 100;
    animation: slideDown 0.3s ease-out;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .calendar-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 4px;
    }
    
    .calendar-day {
        padding: 8px 4px;
        font-size: 0.85em;
        min-height: 35px;
    }
    
    .time-block-item {
        flex-direction: column;
        gap: 8px;
    }
}

