/* Car Rental Calendar - Frontend Styles (Vanilla JS Calendar) */

/* Main wrapper */
.crc-frontend-wrapper {
    max-width: 1200px;
    margin: 1rem auto;
    padding: 1.5rem;
    background: #fff;
    border-radius: 20px;
    box-shadow: var(--rc4u-box-shadow-2);
}

/* Calendar header */
.crc-calendar-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
}

.crc-calendar-header h3 {
    margin: 0 0 15px 0;
    font-size: 24px;
    color: #1f2937;
}

/* Legend */
.crc-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 15px;
}

.crc-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #4b5563;
}

.crc-legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: inline-block;
}

.crc-legend-available {
    background-color: #10b981;
}

.crc-legend-rented {
    background-color: #ef4444;
}

.crc-legend-maintenance {
    background-color: #f59e0b;
}

.crc-legend-blocked {
    background-color: #6b7280;
}

/* Calendar */
.crc-calendar {
    margin: 20px 0;
}

/* Calendar header with navigation */
.crc-calendar .crc-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.crc-month-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #0d1b2a
}

.crc-nav-btn {
    padding: 8px 16px 10px 16px;
    background: #89cff0;
    color: #0d1b29;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: .3s ease
}

.crc-nav-btn:hover {
    background: #0d1b29;
	color: #fff
}

.crc-nav-btn:active {
    background: #89cff0;
	color: #0d1b29
}

/* Calendar grid */
.crc-calendar-grid {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

/* Day names header */
.crc-day-names {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
}

.crc-day-name {
    padding: 12px;
    text-align: center;
    font-weight: 600;
    color: #6b7280;
    font-size: 14px;
}

/* Days grid */
.crc-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e5e7eb;
}

/* Individual day cell */
.crc-day {
    min-height: 100px;
    padding: 8px;
    background: white;
    position: relative;
    transition: background 0.2s;
    display: flex;
    flex-direction: column;
}

.crc-day:not(.crc-day-empty):not(.crc-day-past):hover {
    background: #f0fdf4;
}

.crc-day:not(.crc-day-clickable):hover {
	cursor: not-allowed
}

.crc-day-clickable {
    cursor: pointer;
}

.crc-day-clickable:hover {
    background: #f0fdf4;
    box-shadow: 0 0 0 2px #10b981 inset;
}

.crc-day-empty {
    background: #f9fafb;
}

.crc-day-past {
    background: #fafafa;
    opacity: 0.6;
}

.crc-day-today {
    background: #eff6ff;
}

.crc-day-today .crc-day-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #3b82f6;
    color: #fff;
    border-radius: 50%;
    font-size: 13px;
    line-height: 1;
    margin-bottom: 4px;
}

/* Selected date styles */
.crc-day-selected {
    background: #dbeafe !important;
    border: 2px solid #3b82f6 !important;
}

/* When today is also selected — keep the circle but add selection border */
.crc-day-today.crc-day-selected .crc-day-number,
.crc-day-today.crc-day-in-range .crc-day-number {
    background: #2563eb;
}

.crc-day-selected-start,
.crc-day-selected-end {
    border: 3px solid #2563eb !important
}

.crc-day-in-range {
    background: #e0f2fe !important;
}

.crc-day-number {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

.crc-day-past .crc-day-number {
    color: #9ca3af;
}

/* Events in day cell */
.crc-day-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.crc-event {
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    color: white;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crc-event-available {
    background-color: #10b981;
}

.crc-event-rented {
    background-color: #ef4444;
}

.crc-event-maintenance {
    background-color: #f59e0b;
}

.crc-event-blocked {
    background-color: #6b7280;
}

/* Partial availability label — "Dostępny od HH:00" */
.crc-event-available-from {
    background-color: #10b981;
    font-size: 10px;
    opacity: 0.85;
}

/* Clickable "Dostępny od" badge — on last-day-of-rental partial cells */
.crc-event-available-from--clickable {
    cursor: pointer;
    opacity: 1;
    font-weight: 600;
    transition: -webkit-filter 0.15s;
    transition: filter 0.15s;
    transition: filter 0.15s, -webkit-filter 0.15s;
}

.crc-day-clickable:hover .crc-event-available-from--clickable,
.crc-event-available-from--clickable:hover {
    -webkit-filter: brightness(1.1);
            filter: brightness(1.1);
}

/* "Dostępny do HH:00" badge — on first-day-of-rental partial cells (return only) */
.crc-event-available-until {
    background-color: #10b981; /* green — same as available-from */
    font-size: 10px;
    opacity: 0.85;
}

.crc-event-available-until--clickable {
    cursor: pointer;
    opacity: 1;
    font-weight: 600;
    transition: -webkit-filter 0.15s;
    transition: filter 0.15s;
    transition: filter 0.15s, -webkit-filter 0.15s;
}

.crc-day-clickable:hover .crc-event-available-until--clickable,
.crc-event-available-until--clickable:hover {
    -webkit-filter: brightness(1.1);
            filter: brightness(1.1);
}

/* Calendar info */
.crc-calendar-info {
    margin-top: 20px;
    padding: 15px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    color: #0c4a6e;
}

.crc-calendar-info:empty {
    display: none; 
}

.crc-calendar-info p {
    margin: 0;
    font-size: 14px;
}

/* Mobile day name - hidden on desktop */
.crc-day-name-mobile {
    display: none;
}

/* Bottom navigation - hidden on desktop */
.crc-calendar-bottom-nav {
    display: none;
}

/* Loading state */
.crc-loading {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.crc-loading::after {
    content: "";
    display: block;
    margin: 20px auto;
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    -webkit-animation: crc-spin 0.8s linear infinite;
            animation: crc-spin 0.8s linear infinite;
}

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

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

/* Error message */
.crc-error {
    padding: 15px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #991b1b;
    margin: 20px 0;
}

/* Selection error message */
.crc-selection-error {
    padding: 15px;
    background: #fef2f2;
    border-left: 4px solid #ef4444;
    border-radius: 6px;
    color: #991b1b;
    margin: 20px 0;
    -webkit-animation: crc-slide-in 0.3s ease-out;
            animation: crc-slide-in 0.3s ease-out;
    transition: opacity 0.3s;
}

.crc-selection-error p {
    margin: 0;
    font-size: 14px;
}

@-webkit-keyframes crc-slide-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Success message */
.crc-success {
    padding: 15px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    color: #166534;
    margin: 20px 0;
}

/* Notice message */
.crc-notice {
    padding: 12px;
    background: #fef3c7;
    border: 1px solid #fde047;
    border-radius: 6px;
    color: #92400e;
    margin: 15px 0;
    font-size: 14px;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .crc-frontend-wrapper {
        padding: 15px;
    }
    
    .crc-calendar-header h3 {
        font-size: 20px;
    }
    
    .crc-legend {
        gap: 10px;
    }
    
    .crc-legend-item {
        font-size: 13px;
    }
    
    .crc-day {
        min-height: auto;
        padding: 8px 6px;
    }
    
    .crc-day-number {
        font-size: 12px;
    }
    
    .crc-event {
        font-size: 10px;
        padding: 2px 4px;
    }
    
    .crc-month-title {
        font-size: 16px;
    }
    
    .crc-nav-btn {
        padding: 6px 12px;
        font-size: 16px;
    }
}

@media screen and (max-width: 640px) {
    /* Switch to 3 columns on mobile */
    .crc-day-names {
        display: none; /* Ukryj nagłówki dni na mobile */
    }
    
    .crc-days {
        grid-template-columns: repeat(3, 1fr);
        gap: 2px;
    }
    
    /* Hide day name abbreviations or make them shorter */
    .crc-day-name {
        font-size: 11px;
        padding: 8px 2px;
    }
    
    .crc-day {
        min-height: auto;
        padding: 10px 6px;
    }
    
    .crc-day-number {
        font-size: 14px;
        margin-bottom: 8px;
        font-weight: 700;
    }
    
    /* Mobile day name - show after day number */
    .crc-day-name-mobile {
        display: inline-block;
        font-size: 11px;
        color: #9ca3af;
        font-weight: 400;
        margin-left: 4px;
    }
    
    /* Today: hide mobile day name — circle is enough to identify today */
    .crc-day-today .crc-day-name-mobile {
        display: none;
    }
    
    .crc-event {
        font-size: 11px;
        padding: 4px 6px;
        margin-bottom: 2px;
    }
    
    /* Hide info box on mobile */
    .crc-calendar-info {
        display: none;
    }
    
    /* Booking summary adjustments for mobile */
    .crc-booking-button-wrapper {
        margin-top: 16px;
    }
    
    /* Time picker mobile */
    .crc-time-panel-header {
        font-size: 14px;
        padding: 10px 14px;
    }
    
    .crc-time-section {
        padding: 12px 14px;
    }
    
    .crc-hour-tile {
        min-width: 50px;
        height: 34px;
        font-size: 13px;
    }
    
    .crc-time-summary {
        padding: 12px 14px;
    }
    
    .crc-time-summary-dates {
        font-size: 14px;
    }
    
    .crc-booking-btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 15px;
    }
    
    /* Duplicate navigation at bottom on mobile */
    .crc-calendar-bottom-nav {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 20px;
        padding: 15px;
        background: #f9fafb;
        border-radius: 8px;
        border: 1px solid #e5e7eb;
    }
}

@media screen and (max-width: 480px) {
    /* Even more compact for very small screens */
    .crc-frontend-wrapper {
        padding: 10px;
    }
    
    .crc-day {
        min-height: auto;
        padding: 8px 4px;
    }
    
    .crc-day-number {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .crc-day-today .crc-day-number {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }
    
    .crc-day-name {
        padding: 6px 2px;
        font-size: 10px;
    }
    
    .crc-event {
        font-size: 10px;
        padding: 3px 4px;
    }
    
    .crc-calendar .crc-calendar-header,
    .crc-calendar-bottom-nav {
        padding: 10px;
    }
    
    .crc-month-title {
        font-size: 15px;
    }
    
    .crc-nav-btn {
        padding: 5px 10px;
        font-size: 14px;
    }
}

/* Print styles */
@media print {
    .crc-calendar-info,
    .crc-legend,
    .crc-nav-btn,
    .crc-booking-button-wrapper {
        display: none;
    }
    
    .crc-frontend-wrapper {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .crc-day:not(.crc-day-empty):hover {
        background: white;
    }
}

/* Booking Button Container */
/* =============================================================================
   TIME PICKER PANEL — Step 4: Hour grid selection
   ============================================================================= */

.crc-time-panel {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    -webkit-animation: crc-slide-in 0.3s ease-out;
            animation: crc-slide-in 0.3s ease-out;
}

.crc-time-panel-header {
    background: #f0f7ff;
    padding: 12px 18px;
    font-weight: 600;
    font-size: 15px;
    color: #1e40af;
    border-bottom: 1px solid #bfdbfe;
}

/* Time section (Pickup / Return) */
.crc-time-section {
    padding: 16px 18px;
    border-bottom: 1px solid #f3f4f6;
}

.crc-time-section:last-of-type {
    border-bottom: none;
}

.crc-time-section-label {
    margin-bottom: 10px;
}

.crc-time-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

/* Hour grid */
.crc-hour-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.crc-hour-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    height: 36px;
    padding: 0 8px;
    background: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.crc-hour-tile:hover {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1e40af;
}

.crc-hour-tile.crc-hour-selected {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
    font-weight: 600;
}

/* Status messages inside time section */
.crc-time-status {
    padding: 12px;
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
}

.crc-time-loading {
    background: #f0f7ff;
    color: #3b82f6;
}

.crc-time-loading::after {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border: 2px solid #bfdbfe;
    border-top-color: #3b82f6;
    border-radius: 50%;
    -webkit-animation: crc-spin 0.7s linear infinite;
            animation: crc-spin 0.7s linear infinite;
    vertical-align: middle;
}

.crc-time-empty {
    background: #fef3c7;
    color: #92400e;
}

.crc-time-error {
    background: #fef2f2;
    color: #991b1b;
}

/* Summary inside time panel */
.crc-time-summary {
    padding: 16px 18px;
    background: #f8fafc;
    border-top: 2px solid #e5e7eb;
}

.crc-time-summary-dates {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 6px;
}

.crc-time-summary-period {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 4px;
}

.crc-time-summary-cost {
    font-size: 14px;
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 14px;
}

/* Hint box (select hours prompt) */
.crc-time-hint-box {
    padding: 16px 18px;
    text-align: center;
    background: #f8fafc;
    border-top: 1px solid #e5e7eb;
}

.crc-time-hint-box p {
    margin: 0 0 10px;
    font-size: 14px;
    color: #6b7280;
    font-style: italic;
}

/* =============================================================================
   BOOKING SUMMARY — Card style
   ============================================================================= */

.crc-booking-button-wrapper {
    margin-top: 24px;
}

.crc-booking-summary {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Summary cards */
.crc-summary-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}

/* Action buttons */
.crc-summary-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.crc-booking-btn {
    width: 100%;
    padding: 14px 32px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: .3s ease;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3);
    letter-spacing: 0.5px;
}

.crc-booking-btn:hover {
    background: #2563eb;
    box-shadow: 0 6px 8px rgba(59, 130, 246, 0.4);
}

.crc-booking-btn:active {
    background: #1d4ed8;
    transform: translateY(0);
}

.crc-cancel-btn {
    padding: 10px 24px;
    background: transparent;
    color: #6b7280;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
}

.crc-cancel-btn:hover {
    color: #1f2937;
}

.crc-hint {
    font-size: 14px;
    color: #6b7280;
    font-style: italic;
}
