/* ==========================================================================
   JeRestau - Reservation Form Styles
   ========================================================================== */

/* --- Form Wrapper --- */
.jerestau-form-wrapper {
    max-width: 600px;
    margin: 2rem auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    padding: 2.5rem 2rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

.jerestau-form-wrapper h2 {
    text-align: center;
    color: var(--jerestau-primary, #2c6e49);
    font-size: 1.6rem;
    margin: 0 0 0.4rem 0;
    font-weight: 700;
}

.jerestau-form-wrapper .jerestau-form-subtitle {
    text-align: center;
    color: #6c757d;
    font-size: 0.95rem;
    margin: 0 0 2rem 0;
}

/* --- Form Groups --- */
.jerestau-form-group {
    margin-bottom: 1.25rem;
}

.jerestau-form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
    margin-bottom: 0.4rem;
}

.jerestau-form-group label .required {
    color: #dc3545;
    margin-left: 2px;
}

/* --- Inputs, Selects, Textareas --- */
.jerestau-form-wrapper input[type="text"],
.jerestau-form-wrapper input[type="email"],
.jerestau-form-wrapper input[type="tel"],
.jerestau-form-wrapper input[type="date"],
.jerestau-form-wrapper input[type="number"],
.jerestau-form-wrapper select,
.jerestau-form-wrapper textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    font-size: 0.95rem;
    border: 1.5px solid #dee2e6;
    border-radius: 8px;
    background: #f8f9fa;
    color: #333;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    outline: none;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.jerestau-form-wrapper select {
    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='%236c757d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    padding-right: 2.5rem;
}

.jerestau-form-wrapper textarea {
    min-height: 80px;
    resize: vertical;
}

.jerestau-form-wrapper input:focus,
.jerestau-form-wrapper select:focus,
.jerestau-form-wrapper textarea:focus {
    border-color: var(--jerestau-primary-light, #4c956c);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(76, 149, 108, 0.15);
}

.jerestau-form-wrapper input:disabled,
.jerestau-form-wrapper select:disabled,
.jerestau-form-wrapper textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #e9ecef;
}

/* --- Form Row (date + persons side by side) --- */
.jerestau-form-row {
    display: flex;
    gap: 1rem;
}

.jerestau-form-row .jerestau-form-group {
    flex: 1;
}

/* --- Time Slots Container --- */
.jerestau-time-slots-container {
    position: relative;
    min-height: 44px;
}

.jerestau-time-slots-container .jerestau-slots-loading {
    position: absolute;
    right: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
}

.jerestau-no-slots {
    color: #6c757d;
    font-size: 0.85rem;
    font-style: italic;
    padding: 0.5rem 0;
}

/* --- Primary Button --- */
.jerestau-form-loading {
    display: none;
    text-align: center;
    padding: 1rem;
}

.jerestau-btn-primary {
    display: block;
    width: 100%;
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    background: var(--jerestau-primary, #2c6e49);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    margin-top: 0.5rem;
    text-align: center;
    line-height: 1.4;
}

.jerestau-btn-primary:hover {
    background: var(--jerestau-primary-dark, #245a3b);
    box-shadow: 0 2px 8px rgba(44, 110, 73, 0.3);
}

.jerestau-btn-primary:active {
    transform: scale(0.98);
}

.jerestau-btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* --- Form Messages --- */
.jerestau-form-message {
    padding: 1rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-top: 1.25rem;
    line-height: 1.5;
    display: none;
}

.jerestau-form-message.is-visible {
    display: block;
}

.jerestau-form-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.jerestau-form-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.jerestau-form-message .message-title {
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.jerestau-form-message .message-details {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* --- Spinner --- */
.jerestau-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(44, 110, 73, 0.2);
    border-top-color: #2c6e49;
    border-radius: 50%;
    animation: jerestau-spin 0.7s linear infinite;
    vertical-align: middle;
}

.jerestau-spinner--white {
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
}

.jerestau-spinner--small {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

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

/* --- Button with spinner --- */
.jerestau-btn-primary .jerestau-spinner {
    margin-right: 0.5rem;
}

.jerestau-btn-primary .btn-text {
    vertical-align: middle;
}

/* --- Field validation --- */
.jerestau-form-group.has-error input,
.jerestau-form-group.has-error select,
.jerestau-form-group.has-error textarea {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.jerestau-form-group .field-error {
    color: #dc3545;
    font-size: 0.8rem;
    margin-top: 0.3rem;
    display: none;
}

.jerestau-form-group.has-error .field-error {
    display: block;
}

/* --- Responsive --- */
@media (max-width: 480px) {
    .jerestau-form-wrapper {
        margin: 1rem;
        padding: 1.5rem 1.2rem;
        border-radius: 8px;
    }

    .jerestau-form-wrapper h2 {
        font-size: 1.3rem;
    }

    .jerestau-form-row {
        flex-direction: column;
        gap: 0;
    }

    .jerestau-btn-primary {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
}
