/**
 * Room Booker Pro - Frontend Styles
 * Wersja 2.5.0 - Szary przycisk i poprawki UX
 */

/* === Ogólne === */
.rbp-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    color: #333;
}

/* === Loader === */
.rbp-loader {
    text-align: center;
    padding: 60px 20px;
    display: none; /* Domyślnie ukryty, pokazywany przez JS */
}

.rbp-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #ff3800;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: rbp-spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes rbp-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === Grid Layout === */
.rbp-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-top: 20px;
}

/* === Komunikaty === */
.rbp-error-message,
.rbp-success-message {
    padding: 15px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-weight: 500;
}

.rbp-error-message {
    background-color: #fee;
    border-left: 4px solid #c33;
    color: #c33;
}

.rbp-success-message {
    background-color: #efe;
    border-left: 4px solid #3c3;
    color: #3c3;
}

/* === Kroki === */
.rbp-step {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    scroll-margin-top: 20px;
}

.rbp-step h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.5em;
    color: #222;
}

/* === Kafelki sal === */
.rbp-rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.rbp-room-tile {
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
}

.rbp-room-tile:hover {
    border-color: #ff3800;
    box-shadow: 0 4px 12px rgba(255, 56, 0, 0.2);
    transform: translateY(-2px);
}

.rbp-room-tile.selected {
    border-color: #ff3800;
    box-shadow: 0 0 0 3px rgba(255, 56, 0, 0.2);
}

.rbp-room-image {
    height: 180px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rbp-room-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rbp-room-placeholder {
    font-size: 4em;
    opacity: 0.3;
}

.rbp-room-content {
    padding: 15px;
}

.rbp-room-content h3 {
    margin: 0 0 10px 0;
    font-size: 1.2em;
    color: #222;
}

.rbp-room-capacity,
.rbp-room-price {
    margin: 5px 0;
    font-size: 0.9em;
    color: #666;
    display: flex;
    align-items: center;
    gap: 5px;
}

.rbp-room-price strong {
    color: #ff3800;
    font-size: 1.1em;
}

.rbp-room-features {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.rbp-feature-icon {
    font-size: 1.2em;
    opacity: 0.7;
}

/* === Formularze === */
.rbp-form-group {
    margin-bottom: 20px;
}

.rbp-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.rbp-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.rbp-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    line-height: 1.6;
    min-height: 48px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

select.rbp-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

select.rbp-input option {
    padding: 8px;
    font-size: 16px;
    line-height: 1.8;
}

.rbp-input:focus {
    outline: none;
    border-color: #ff3800;
}

.rbp-input:invalid:not(:placeholder-shown) {
    border-color: #c33;
}

#rbp-event-details {
    resize: vertical;
    min-height: 100px;
}

#rbp-event-details:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.rbp-field-hint {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

[data-char-count] {
    font-weight: 600;
    transition: color 0.3s ease;
}

/* === Picker daty === */
.rbp-datetime-picker {
    max-width: 600px;
}

/* === Kod rabatowy === */
.rbp-discount-input {
    display: flex;
    gap: 10px;
}

.rbp-discount-input .rbp-input {
    flex: 1;
}

.rbp-discount-message {
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
    font-size: 0.9em;
}

.rbp-discount-success {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 3px solid #2e7d32;
}

.rbp-discount-error {
    background: #ffebee;
    color: #c62828;
    border-left: 3px solid #c62828;
}

/* === Sidebar / Summary === */
#rbp-summary-container {
    position: sticky;
    top: 20px;
    z-index: 900;
}

.rbp-summary {
    background: #f9f9f9;
    padding: 25px;
    border-radius: 8px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Scrollbar dla długiego podsumowania */
.rbp-summary::-webkit-scrollbar {
    width: 6px;
}

.rbp-summary::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.rbp-summary::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.rbp-summary::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.rbp-summary h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.3em;
    color: #222;
}

.rbp-summary-item {
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.rbp-summary-item:last-of-type {
    border-bottom: none;
}

.rbp-summary-item strong {
    color: #555;
}

.rbp-summary-divider {
    height: 1px;
    background: #ddd;
    margin: 15px 0;
}

/* === Szczegóły ceny === */
.rbp-price-breakdown {
    margin: 15px 0;
}

.rbp-price-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 0.95em;
}

.rbp-price-adjustment {
    color: #666;
    font-size: 0.9em;
}

.rbp-price-discount {
    color: #4caf50;
}

.rbp-summary-total {
    display: flex;
    justify-content: space-between;
    padding: 15px 0 20px;
    font-size: 1.2em;
}

.rbp-total-price {
    color: #ff3800;
    font-size: 1.4em;
}

.rbp-summary-note {
    margin-top: 15px;
    font-size: 0.85em;
    color: #666;
    text-align: center;
    font-style: italic;
}

/* === Przyciski === */
.rbp-button {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.rbp-button-primary {
    background: #ff3800;
    color: #fff;
}

.rbp-button-primary:hover:not(:disabled) {
    background: #e63300;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 56, 0, 0.3);
}

.rbp-button-secondary {
    background: #555;
    color: #fff;
}

.rbp-button-secondary:hover:not(:disabled) {
    background: #333;
}

.rbp-button-large {
    width: 100%;
    padding: 16px;
    font-size: 1.1em;
}

.rbp-button:disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
    opacity: 0.6;
}

/* --- NOWOŚĆ: Styl dla szarego przycisku (nieaktywnego formularza) --- */
.rbp-button-gray {
    background-color: #666666 !important; /* Ciemnoszary */
    border-color: #555555 !important;
    color: #ffffff !important;
    cursor: pointer !important; /* Zachęta do kliknięcia */
    transition: background-color 0.3s ease;
}

.rbp-button-gray:hover {
    background-color: #444444 !important; /* Ciemniejszy przy najechaniu */
}

/* === Regulamin === */
.rbp-terms-checkbox {
    margin: 20px 0;
    padding: 15px 20px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
}

.rbp-terms-checkbox label {
    display: block !important;
    cursor: pointer;
    line-height: 1.8;
    font-size: 14px;
}

.rbp-terms-checkbox input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    vertical-align: middle;
    cursor: pointer;
}

.rbp-terms-checkbox a {
    color: #ff3800;
    text-decoration: underline;
    font-weight: 600;
}

.rbp-terms-checkbox a:hover {
    color: #e63300;
}

/* === Flatpickr customization === */
.flatpickr-calendar {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.flatpickr-day.selected {
    background: #ff3800;
    border-color: #ff3800;
}

.flatpickr-day.selected:hover {
    background: #e63300;
    border-color: #e63300;
}

/* === Kafelki czasu (Krok 2) === */
.rbp-time-range-cards { margin: 20px 0; }
.rbp-time-range-cards h4 { margin-bottom: 15px; font-size: 1.1em; color: #333; }

.rbp-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.rbp-time-range-card {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.rbp-time-range-card:hover {
    border-color: #ff3800;
    box-shadow: 0 4px 12px rgba(255, 56, 0, 0.2);
    transform: translateY(-2px);
    background: #fff8f5;
}

.rbp-time-range-card.selected { /* Jeśli dodasz klasę selected w JS */
    border-color: #ff3800;
    background: #fff8f5;
}

.rbp-time-range-card.unavailable {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f5f5f5;
}
.rbp-time-range-card.unavailable:hover {
    border-color: #e0e0e0;
    transform: none;
    box-shadow: none;
}

.rbp-card-icon { font-size: 2.5em; margin-bottom: 10px; line-height: 1; }
.rbp-card-title { font-size: 1.2em; font-weight: 600; color: #222; margin-bottom: 5px; }
.rbp-card-hours { font-size: 0.9em; color: #666; margin-bottom: 10px; }
.rbp-card-unavailable { font-size: 0.85em; color: #999; font-style: italic; }

/* === Timeline === */
.rbp-timeline-container { margin-top: 20px; }
.rbp-timeline-header { margin-bottom: 15px; }
.rbp-timeline-header h4 { margin: 0 0 5px 0; color: #222; }
.rbp-timeline-header p { margin: 0 0 10px 0; color: #666; font-size: 0.95em; }

.rbp-btn-back {
    background: #f0f0f0;
    border: 1px solid #ddd;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    color: #555;
    transition: all 0.2s ease;
}
.rbp-btn-back:hover { background: #e5e5e5; border-color: #ccc; color: #333; }

.rbp-no-slots {
    text-align: center;
    padding: 40px 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 2px dashed #ddd;
}
.rbp-no-slots p { margin: 10px 0; color: #666; }
.rbp-no-slots .rbp-btn-back { margin-top: 15px; }

/* === Siatka slotów === */
.rbp-time-slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
}

.rbp-time-slot {
    padding: 12px 8px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #333;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.rbp-time-slot:hover {
    border-color: #ff3800;
    background: #fff5f2;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 56, 0, 0.15);
}

.rbp-time-slot.selected {
    border-color: #ff3800;
    background: #ff3800;
    color: #fff;
    box-shadow: 0 4px 12px rgba(255, 56, 0, 0.3);
}

/* === Czas trwania === */
.rbp-duration-container {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e9ecef;
}

.rbp-duration-slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.rbp-duration-slot {
    padding: 14px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #333;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rbp-duration-slot:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.15);
}

.rbp-duration-slot.selected {
    border-color: #667eea;
    background: #667eea;
    color: #fff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.rbp-duration-end {
    font-size: 12px;
    font-weight: 400;
    opacity: 0.8;
}

.rbp-duration-slot.selected .rbp-duration-end { opacity: 0.9; }

.rbp-no-durations {
    text-align: center;
    padding: 30px 20px;
    background: #fff8e1;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
}
.rbp-no-durations p { margin: 0; color: #856404; font-weight: 500; }

/* === Stawka godzinowa === */
.rbp-hourly-rate-info {
    margin-top: 20px;
    padding: 15px 20px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rbp-rate-label { font-size: 1em; color: #666; font-weight: 500; }
.rbp-rate-value { font-size: 1.3em; color: #ff3800; font-weight: 700; }

/* === Usługi Dodatkowe === */
.rbp-step-services { margin-top: 20px; }
.rbp-services-intro { color: #666; font-size: 0.95em; margin-bottom: 20px; }
.rbp-services-list { display: flex; flex-direction: column; gap: 15px; }

.rbp-service-item {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    background: #fff;
    transition: all 0.3s ease;
    cursor: pointer;
}
.rbp-service-item:hover { border-color: #667eea; box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15); }
.rbp-service-item.selected { border-color: #667eea; background: #f8f9ff; box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1); }

.rbp-service-label { display: flex; gap: 15px; cursor: pointer; width: 100%; margin: 0; }
.rbp-service-checkbox { flex-shrink: 0; width: 20px; height: 20px; margin-top: 2px; cursor: pointer; }
.rbp-service-content { flex: 1; }

.rbp-service-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.rbp-service-name { font-size: 1.1em; font-weight: 600; color: #222; }

.rbp-service-type { font-size: 0.85em; padding: 3px 10px; border-radius: 12px; font-weight: 600; }
.rbp-service-type-paid { background: #d4edda; color: #155724; }
.rbp-service-type-contact { background: #d1ecf1; color: #0c5460; }

.rbp-service-description { color: #666; font-size: 0.9em; margin: 0 0 10px 0; }
.rbp-service-pricing { font-size: 0.95em; color: #667eea; font-weight: 600; }
.rbp-service-pricing-details { display: block; color: #888; font-size: 0.85em; margin-top: 4px; font-weight: 400; }

.rbp-services-skip-info {
    background: #f0f8ff;
    border-left: 4px solid #2196F3;
    padding: 15px 20px;
    margin: 15px 0 20px 0;
    border-radius: 4px;
}
.rbp-services-skip-info p { margin: 0; }

.rbp-services-names-small { font-size: 0.85em; color: #666; margin-top: 3px; line-height: 1.4; }
.rbp-services-names-small div { margin: 2px 0; }

/* === Sekcja Faktur === */
.rbp-invoice-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    border-left: 4px solid #667eea;
}
.rbp-invoice-section h4 { margin: 0 0 10px 0; color: #333; font-size: 1.1em; }
.rbp-invoice-info { font-size: 0.9em; margin-bottom: 15px; color: #666; }

/* Walidacja NIP */
.rbp-nip-validation { margin-top: 5px; padding: 8px 12px; border-radius: 4px; font-size: 0.9em; font-weight: 500; }
.rbp-nip-valid { background: #d4edda; color: #155724; border-left: 3px solid #28a745; }
.rbp-nip-invalid { background: #f8d7da; color: #721c24; border-left: 3px solid #dc3545; }

/* === Modal Płatności === */
.rbp-payment-result {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999; animation: fadeIn 0.3s ease-in;
}
.rbp-result-container {
    background: white; padding: 40px; border-radius: 12px;
    max-width: 500px; width: 90%; text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); animation: slideIn 0.4s ease-out;
}
.rbp-result-container h2 { margin: 0 0 20px 0; font-size: 24px; }
.rbp-result-content { margin: 20px 0; line-height: 1.6; }
.rbp-result-actions { margin-top: 30px; display: flex; gap: 15px; justify-content: center; flex-wrap: wrap; }

.rbp-btn { padding: 12px 24px; border: none; border-radius: 6px; font-size: 16px; cursor: pointer; text-decoration: none; display: inline-block; transition: all 0.2s ease; }
.rbp-btn-primary { background: #4caf50; color: white; }
.rbp-btn-primary:hover { background: #45a049; }
.rbp-btn-secondary { background: #e0e0e0; color: #333; }
.rbp-btn-secondary:hover { background: #d5d5d5; }

.rbp-payment-success .rbp-result-container { border-top: 5px solid #4caf50; }
.rbp-payment-failed .rbp-result-container { border-top: 5px solid #f44336; }
.rbp-payment-pending .rbp-result-container { border-top: 5px solid #ff9800; }
.rbp-payment-unknown .rbp-result-container { border-top: 5px solid #9e9e9e; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateY(-50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* === Responsywność === */
@media (max-width: 768px) {
    .rbp-grid { grid-template-columns: 1fr; }
    .rbp-container { padding: 10px; }
    .rbp-step { padding: 20px; }
    .rbp-summary { position: static; margin-top: 20px; }
    .rbp-sidebar-column { order: 2; }
    .rbp-main-column { order: 1; }
    
    .rbp-cards-grid { grid-template-columns: 1fr; gap: 12px; }
    .rbp-time-range-card { padding: 15px; }
    .rbp-card-icon { font-size: 2em; }
    
    .rbp-time-slots { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 8px; }
    .rbp-duration-slots { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
    
    .rbp-hourly-rate-info { flex-direction: column; gap: 5px; text-align: center; }
    
    .rbp-invoice-section { padding: 15px; }
    .rbp-form-row { grid-template-columns: 1fr; }
    
    .rbp-service-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .rbp-service-item { padding: 12px; }
    .rbp-service-label { gap: 10px; }
}

@media (max-width: 600px) {
    .rbp-result-container { padding: 30px 20px; margin: 20px; }
    .rbp-result-actions { flex-direction: column; }
    .rbp-btn { width: 100%; }
}

@media (max-width: 480px) {
    .rbp-time-slot { padding: 10px 6px; font-size: 14px; }
    .rbp-duration-slot { padding: 12px 10px; font-size: 15px; }
    .rbp-duration-end { font-size: 11px; }
}