/**
 * Frontend Styles
 *
 * @package HRM_Booking_Manager
 */

/* ====================
   Booking Form
   ==================== */
.hrm-booking-form-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.hrm-booking-title {
    text-align: center;
    margin-bottom: 30px;
    font-size: 28px;
    color: #333;
}

/* ====================
   Room Slideshow
   ==================== */
.hrm-room-slideshow-wrapper {
    margin-bottom: 40px;
    position: relative;
}

.hrm-room-slideshow {
    background: 7c4dff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.hrm-room-slide {
    position: relative;
    outline: none;
}

.hrm-room-image {
    width: 100%;
    height: 500px;
    object-fit: cover;
    display: block;
}

.hrm-room-placeholder {
    width: 100%;
    height: 500px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 120px;
    color: #ccc;
}

.hrm-room-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    color: 7c4dff;
    padding: 30px;
}

.hrm-room-title {
    margin: 0 0 10px 0;
    font-size: 24px;
    color: 7c4dff;
}

.hrm-room-excerpt {
    margin: 0;
    font-size: 16px;
    color: #eee;
}

.hrm-room-title-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: all 0.3s;
}

.hrm-room-title-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.hrm-room-price {
    margin: 10px 0 0 0;
    font-size: 20px;
    font-weight: 600;
    color: 7c4dff;
}

.hrm-room-price .hrm-price-period {
    font-size: 14px;
    font-weight: 400;
    color: #ddd;
    margin-left: 5px;
}

/* Slick carousel arrows */
.hrm-room-slideshow .slick-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0;
    transition: all 0.3s;
}

.hrm-room-slideshow .slick-arrow:hover {
    background: 7c4dff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.hrm-room-slideshow .slick-arrow::before {
    font-size: 24px;
    color: #333;
}

.hrm-room-slideshow .slick-prev {
    left: 20px;
}

.hrm-room-slideshow .slick-next {
    right: 20px;
}

/* Slick dots */
.hrm-room-slideshow .slick-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    list-style: none;
    display: flex !important;
    gap: 10px;
    padding: 0;
    margin: 0;
}

.hrm-room-slideshow .slick-dots li {
    margin: 0;
}

.hrm-room-slideshow .slick-dots li button {
    width: 12px;
    height: 12px;
    padding: 0;
    border: 2px solid 7c4dff;
    border-radius: 50%;
    background: transparent;
    font-size: 0;
    cursor: pointer;
    transition: all 0.3s;
}

.hrm-room-slideshow .slick-dots li.slick-active button {
    background: 7c4dff;
}

/* ====================
   Booking Form
   ==================== */
.hrm-booking-form {
    background: 7c4dff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.hrm-form-section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid #eee;
}

.hrm-form-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
}

.hrm-form-section h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 20px;
    color: #333;
}

.hrm-form-section h4 {
    margin-top: 20px;
    margin-bottom: 15px;
    font-size: 16px;
    color: #666;
}

.hrm-form-row {
    margin-bottom: 20px;
}

.hrm-form-row-half {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.hrm-form-row-third {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 15px;
    width: 100%;
    box-sizing: border-box;
}

.hrm-form-row-third .hrm-form-group {
    min-width: 0; /* Previene overflow */
}

.hrm-form-group {
    display: flex;
    flex-direction: column;
}

.hrm-form-group label {
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.hrm-form-control {
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: all 0.3s;
    font-family: inherit;
}

.hrm-form-control:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.hrm-form-control:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

textarea.hrm-form-control {
    resize: vertical;
    min-height: 100px;
}

select.hrm-form-control {
    cursor: pointer;
    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='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

/* ====================
   Supplements
   ==================== */
#hrm-supplements-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#hrm-supplements-list label {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #f9f9f9;
    border: 2px solid #eee;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

#hrm-supplements-list label:hover {
    background: #f0f0f0;
    border-color: #ddd;
}

#hrm-supplements-list input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
}

#hrm-supplements-list input[type="checkbox"]:checked + span {
    font-weight: 600;
}

.supplement-price {
    margin-left: auto;
    color: #666;
    font-size: 14px;
}

/* ====================
   Price Summary
   ==================== */
.hrm-price-summary {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 4px;
}

#hrm-price-display {
    font-size: 16px;
}

#hrm-price-display table {
    width: 100%;
    border-collapse: collapse;
}

#hrm-price-display td {
    padding: 10px 0;
    border-bottom: 1px solid #ddd;
}

#hrm-price-display td:last-child {
    text-align: right;
}

#hrm-price-display tr:last-child td {
    border-bottom: none;
    padding-top: 15px;
    font-size: 18px;
    font-weight: 600;
    color: #0073aa;
}

.hrm-price-placeholder {
    text-align: center;
    color: #999;
    font-style: italic;
}

/* ====================
   Form Actions
   ==================== */
.hrm-form-actions {
    text-align: center;
    margin-top: 30px;
}

.hrm-submit-button {
    background: #0073aa;
    color: 7c4dff;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.hrm-submit-button:hover {
    background: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.hrm-submit-button:active {
    transform: translateY(0);
}

.hrm-submit-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* ====================
   Messages
   ==================== */
.hrm-message {
    padding: 15px 20px;
    border-radius: 4px;
    text-align: center;
    font-weight: bold;
    font-size: 15px;
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    min-width: 300px;
    max-width: 90%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.hrm-message.hrm-success {
    background: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
}

.hrm-message.hrm-error {
    background: #f8d7da;
    color: #721c24;
    border: 3px solid #dc3545;
    font-size: 16px;
    font-weight: bold;
}

.hrm-message.hrm-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 2px solid #bee5eb;
}

/* ====================
   Room Selector Grid
   ==================== */
.hrm-rooms-grid {
    display: grid;
    gap: 30px;
    margin: 30px 0;
}

.hrm-rooms-grid-1 {
    grid-template-columns: 1fr;
}

.hrm-rooms-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.hrm-rooms-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.hrm-rooms-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.hrm-room-card {
    background: 7c4dff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.hrm-room-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.hrm-room-card-image {
    position: relative;
    padding-bottom: 66.67%; /* 3:2 aspect ratio */
    overflow: hidden;
}

.hrm-room-card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hrm-room-card-content {
    padding: 20px;
}

.hrm-room-card-title {
    margin: 0 0 10px 0;
    font-size: 20px;
    color: #333;
}

.hrm-room-card-excerpt {
    margin: 0 0 15px 0;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

.hrm-room-card-price {
    margin: 15px 0;
    font-size: 24px;
    font-weight: 600;
    color: #0073aa;
}

.hrm-price-period {
    font-size: 14px;
    font-weight: 400;
    color: #666;
}

.hrm-room-card-link {
    display: inline-block;
    padding: 10px 20px;
    background: #0073aa;
    color: 7c4dff;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s;
}

.hrm-room-card-link:hover {
    background: #005a87;
}

/* ====================
   Loading State
   ==================== */
.hrm-loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: hrm-spin 1s linear infinite;
}

@keyframes hrm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ====================
   Responsive Design
   ==================== */

/* Tablet - Medium breakpoint */
@media screen and (max-width: 1024px) and (min-width: 769px) {
    .hrm-booking-form-wrapper {
        max-width: 95%;
    }

    /* Transform 3 columns into 2 columns on tablet */
    .hrm-form-row-third {
        grid-template-columns: 1fr 1fr;
    }

    /* The third field takes full width */
    .hrm-form-row-third > .hrm-form-group:nth-child(3) {
        grid-column: 1 / -1;
    }

    /* Room grid: max 2 columns on tablet */
    .hrm-room-grid-cols-3,
    .hrm-room-grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile */
@media screen and (max-width: 768px) {
    .hrm-booking-form-wrapper {
        padding: 15px;
    }

    .hrm-booking-title {
        font-size: 24px;
    }

    .hrm-room-image,
    .hrm-room-placeholder {
        height: 300px;
    }

    .hrm-room-info {
        padding: 20px;
    }

    .hrm-room-title {
        font-size: 20px;
    }

    .hrm-booking-form {
        padding: 20px;
    }

    .hrm-form-row-half,
    .hrm-form-row-third {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .hrm-rooms-grid-2,
    .hrm-rooms-grid-3,
    .hrm-rooms-grid-4 {
        grid-template-columns: 1fr;
    }

    .hrm-submit-button {
        width: 100%;
        justify-content: center;
    }
}

@media screen and (max-width: 480px) {
    .hrm-room-image,
    .hrm-room-placeholder {
        height: 250px;
    }

    .hrm-form-control {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* ====================
   Accessibility
   ==================== */
.hrm-form-control:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.hrm-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .hrm-form-control {
        border-width: 2px;
    }

    .hrm-submit-button {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print styles */
@media print {
    .hrm-room-slideshow-wrapper,
    .hrm-form-actions,
    .slick-arrow,
    .slick-dots {
        display: none !important;
    }

    .hrm-booking-form {
        box-shadow: none;
    }
}

/* ====================
   Room Grid Integration
   ==================== */
.hrm-room-grid-section {
    margin-bottom: 40px;
    padding: 20px 0;
}

.hrm-grid-title {
    text-align: center;
    margin-bottom: 30px;
    font-size: 24px;
    color: #333;
    font-weight: 600;
}

/* Improved styles for integrated grid */
.hrm-room-grid-section .hrm-room-grid {
    margin-top: 20px;
}

.hrm-room-grid-section .hrm-room-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.hrm-room-grid-section .hrm-room-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.hrm-room-grid-section .hrm-room-card.selected {
    border: 3px solid #2ecc71;
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.2);
}

/* Integration with the form */
.hrm-room-grid-section + .hrm-booking-form-wrapper {
    margin-top: 20px;
    background: transparent;
    border: none;
    padding-top: 0;
}

/* Clean styles for the form wrapper */
.hrm-booking-form-wrapper {
    background: transparent;
    border: none;
}

/* Responsive for integrated grid */
@media (max-width: 768px) {
    .hrm-room-grid-section .hrm-room-grid-cols-2 {
        grid-template-columns: 1fr;
    }

    .hrm-grid-title {
        font-size: 20px;
    }
}
/* Style for the View Room button */
.hrm-view-room-btn {
    display: block;
    width: 100%;
    padding: 0.875rem 1.5rem;
    margin-top: 10px;
    background: #28a745; /* Verde */
    color: 7c4dfffff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none;
    text-align: center;
}

.hrm-view-room-btn:hover {
    background: #218838; /* Darker green */
    color: 7c4dfffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
    text-decoration: none;
}

.hrm-view-room-btn:focus {
    outline: 3px solid #28a745;
    outline-offset: 2px;
}

/* When the room is selected, also highlight the button */
.hrm-room-card.selected .hrm-view-room-btn {
    background: #1e7e34;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.4);
}

/* Icon in the button (optional) */
.hrm-view-room-btn::before {
    content: "👁 ";
    margin-right: 5px;
}

/* Or use a different icon */
.hrm-view-room-btn::before {
    content: "→ ";
    margin-right: 5px;
    font-weight: bold;
}

/* ====================
   No Availability Alert
   ==================== */
.hrm-no-availability-alert {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: #fff;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(220, 53, 69, 0.4);
    animation: hrm-pulse-alert 2s ease-in-out infinite;
    border: 3px solid #fff;
}

.hrm-no-availability-alert .hrm-alert-icon {
    font-size: 48px;
    margin-bottom: 15px;
    display: block;
}

.hrm-no-availability-alert .hrm-alert-content strong {
    display: block;
    font-size: 22px;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hrm-no-availability-alert .hrm-alert-content p {
    margin: 0;
    font-size: 16px;
    opacity: 0.95;
}

@keyframes hrm-pulse-alert {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 8px 25px rgba(220, 53, 69, 0.4);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 12px 35px rgba(220, 53, 69, 0.5);
    }
}

/* Form disabled state */
.hrm-booking-form-wrapper.hrm-form-disabled {
    position: relative;
}

.hrm-booking-form-wrapper.hrm-form-disabled::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 100;
    pointer-events: all;
    cursor: not-allowed;
}

.hrm-booking-form-wrapper.hrm-form-disabled .hrm-booking-form {
    pointer-events: none;
    opacity: 0.5;
    filter: grayscale(50%);
}

.hrm-booking-form-wrapper.hrm-form-disabled .hrm-room-slideshow-wrapper {
    pointer-events: none;
    opacity: 0.5;
    filter: grayscale(50%);
}

.hrm-room-grid-section.hrm-grid-disabled {
    pointer-events: none;
    opacity: 0.5;
    filter: grayscale(50%);
}

/* ====================
   Dates Unavailable Alert
   ==================== */
.hrm-dates-unavailable-alert {
    background: linear-gradient(135deg, #fd7e14 0%, #e55300 100%);
    color: #fff;
    padding: 25px 50px 25px 30px;
    border-radius: 12px;
    margin-bottom: 25px;
    text-align: center;
    box-shadow: 0 6px 20px rgba(253, 126, 20, 0.4);
    animation: hrm-shake-alert 0.5s ease-in-out;
    border: 3px solid #fff;
    position: relative;
}

.hrm-dates-unavailable-alert .hrm-alert-icon {
    font-size: 40px;
    margin-bottom: 12px;
    display: block;
}

.hrm-dates-unavailable-alert .hrm-alert-content strong {
    display: block;
    font-size: 20px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hrm-dates-unavailable-alert .hrm-alert-content p {
    margin: 0;
    font-size: 15px;
    opacity: 0.95;
}

.hrm-dates-unavailable-alert .hrm-alert-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 50%;
    line-height: 1;
    transition: background 0.3s;
}

.hrm-dates-unavailable-alert .hrm-alert-close:hover {
    background: rgba(255,255,255,0.4);
}

@keyframes hrm-shake-alert {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Submit button disabled state */
.hrm-submit-button.hrm-btn-disabled,
#hrm-submit-booking.hrm-btn-disabled {
    background: #ccc !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

/* ====================
   Children Discount & Guests
   ==================== */

/* Form row thirds */
.hrm-form-row-third {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.hrm-form-row-third .hrm-form-group {
    flex: 1;
    min-width: 100px;
}

/* Children discount info box */
.hrm-children-discount-notice {
    padding: 10px 15px;
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    border-radius: 0 4px 4px 0;
    color: #1565c0;
    font-size: 14px;
}

.hrm-children-discount-notice .dashicons {
    vertical-align: middle;
    margin-right: 5px;
}

/* Price breakdown - discount row */
.hrm-discount-amount,
.hrm-discount-amount td {
    color: #2e7d32 !important;
}

/* Total guests field (readonly) */
#hrm-guests[readonly] {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

/* Price summary table */
#hrm-price-display table tr.hrm-discount-amount td {
    color: #2e7d32;
    font-style: italic;
}

#hrm-price-display table tr.hrm-total-row {
    border-top: 2px solid #333;
}

#hrm-price-display table tr.hrm-total-row td {
    padding-top: 10px;
}

/* Responsive for guests row */
@media (max-width: 600px) {
    .hrm-form-row-third {
        flex-direction: column;
    }
    
    .hrm-form-row-third .hrm-form-group {
        width: 100%;
    }
}

/* ====================
   Privacy Checkbox Section
   ==================== */
.hrm-privacy-section {
    margin-top: 20px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.hrm-checkbox-group {
    display: flex;
    flex-direction: column;
}

.hrm-checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
}

.hrm-checkbox-label input[type="checkbox"] {
    margin-right: 10px;
    margin-top: 3px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

.hrm-checkbox-text {
    flex: 1;
}

.hrm-checkbox-text a {
    color: #0073aa;
    text-decoration: underline;
}

.hrm-checkbox-text a:hover {
    color: #005177;
}

.hrm-required {
    color: #dc3545;
    margin-left: 2px;
}

.hrm-privacy-error {
    margin-top: 8px;
    padding: 8px 12px;
    background: #fff5f5;
    border: 1px solid #dc3545;
    border-radius: 4px;
    font-size: 13px;
}

/* Error state for checkbox */
.hrm-checkbox-label input[type="checkbox"].hrm-field-error {
    outline: 2px solid #dc3545;
    outline-offset: 2px;
}
