/* ==========================================================================
   RentMaster Frontend Styles
   ========================================================================== */

/* ── Variables (scoped to widget) ───────────────────────────────────────── */
.rm-booking-widget,
.rm-availability-calendar {
    --rm-primary:       #2271b1;
    --rm-primary-hover: #135e96;
    --rm-primary-light: #e8f0fe;
    --rm-secondary:     #6c757d;
    --rm-secondary-hover: #565e64;
    --rm-success:       #00a32a;
    --rm-warning:       #dba617;
    --rm-danger:        #d63638;
    --rm-border:        #dcdcde;
    --rm-bg:            #ffffff;
    --rm-bg-light:      #f6f7f7;
    --rm-text:          #1d2327;
    --rm-text-muted:    #646970;
    --rm-radius:        6px;
    --rm-shadow:        0 1px 3px rgba(0, 0, 0, 0.08);
    --rm-shadow-hover:  0 4px 12px rgba(0, 0, 0, 0.12);
    --rm-transition:    0.2s ease;
}

/* ── Widget Container ───────────────────────────────────────────────────── */
.rm-booking-widget {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--rm-text);
    background: var(--rm-bg);
    border: 1px solid var(--rm-border);
    border-radius: var(--rm-radius);
    box-shadow: var(--rm-shadow);
    overflow: hidden;
}

/* ── Steps ──────────────────────────────────────────────────────────────── */
.rm-step {
    padding: 28px 32px;
}

.rm-step-title {
    margin: 0 0 20px 0;
    padding: 0 0 14px 0;
    font-size: 1.3em;
    font-weight: 600;
    color: var(--rm-text);
    border-bottom: 2px solid var(--rm-primary);
}

.rm-step-content {
    margin-bottom: 8px;
}

/* ── Form Rows & Groups ────────────────────────────────────────────────── */
.rm-form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    align-items: flex-start;
}

.rm-form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.rm-form-group-full {
    flex: 1 1 100%;
}

.rm-form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 600;
    color: var(--rm-text);
}

.rm-form-group input[type="text"],
.rm-form-group input[type="email"],
.rm-form-group input[type="tel"],
.rm-form-group input[type="date"],
.rm-form-group input[type="number"],
.rm-form-group select,
.rm-form-group textarea {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--rm-text);
    background: var(--rm-bg);
    border: 1px solid var(--rm-border);
    border-radius: var(--rm-radius);
    transition: border-color var(--rm-transition), box-shadow var(--rm-transition);
    box-sizing: border-box;
}

.rm-form-group input:focus,
.rm-form-group select:focus,
.rm-form-group textarea:focus {
    outline: none;
    border-color: var(--rm-primary);
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.15);
}

.rm-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Rental type radio row */
.rm-rental-type-row {
    align-items: center;
    gap: 12px;
    padding-top: 4px;
}

.rm-rental-type-label {
    font-weight: 600;
    font-size: 13px;
    color: var(--rm-text);
}

.rm-radio-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    cursor: pointer;
    color: var(--rm-text);
}

.rm-radio-label input[type="radio"] {
    margin: 0;
    accent-color: var(--rm-primary);
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.rm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--rm-radius);
    cursor: pointer;
    transition: background var(--rm-transition), border-color var(--rm-transition), box-shadow var(--rm-transition);
    white-space: nowrap;
}

.rm-btn:focus-visible {
    outline: 2px solid var(--rm-primary);
    outline-offset: 2px;
}

.rm-btn-primary {
    color: #ffffff;
    background: var(--rm-primary);
    border-color: var(--rm-primary);
}

.rm-btn-primary:hover {
    background: var(--rm-primary-hover);
    border-color: var(--rm-primary-hover);
}

.rm-btn-secondary {
    color: var(--rm-secondary);
    background: var(--rm-bg);
    border-color: var(--rm-border);
}

.rm-btn-secondary:hover {
    color: var(--rm-text);
    background: var(--rm-bg-light);
    border-color: var(--rm-secondary);
}

.rm-btn:disabled,
.rm-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Step Navigation ────────────────────────────────────────────────────── */
.rm-step-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    margin-top: 12px;
    border-top: 1px solid var(--rm-border);
}

/* ── Category Filter ────────────────────────────────────────────────────── */
.rm-category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--rm-border);
}

.rm-cat-btn {
    display: inline-block;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--rm-text);
    background: var(--rm-bg-light);
    border: 1px solid var(--rm-border);
    border-radius: 20px;
    cursor: pointer;
    transition: all var(--rm-transition);
}

.rm-cat-btn:hover {
    background: var(--rm-primary-light);
    border-color: var(--rm-primary);
    color: var(--rm-primary);
}

.rm-cat-btn.active {
    background: var(--rm-primary);
    border-color: var(--rm-primary);
    color: #ffffff;
}

/* ── Equipment Grid ─────────────────────────────────────────────────────── */
.rm-equipment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.rm-placeholder-message {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--rm-text-muted);
    font-size: 14px;
    padding: 40px 20px;
    margin: 0;
}

/* ── Equipment Card ─────────────────────────────────────────────────────── */
.rm-equipment-card {
    background: var(--rm-bg);
    border: 1px solid var(--rm-border);
    border-radius: var(--rm-radius);
    overflow: hidden;
    transition: box-shadow var(--rm-transition), border-color var(--rm-transition);
}

.rm-equipment-card:hover {
    box-shadow: var(--rm-shadow-hover);
    border-color: var(--rm-primary);
}

.rm-equipment-card.rm-card-selected {
    border-color: var(--rm-primary);
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.2), var(--rm-shadow-hover);
}

.rm-card-image {
    width: 100%;
    height: 180px;
    overflow: hidden;
    display: block;
    background: var(--rm-bg-light);
    position: relative;
}
.rm-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.rm-card-placeholder-img {
    width: 100%;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--rm-bg-light);
    color: var(--rm-border);
    font-size: 48px;
}

.rm-card-body {
    padding: 14px;
}

.rm-card-name {
    margin: 0 0 6px 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--rm-text);
    line-height: 1.3;
}

.rm-card-description {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: var(--rm-text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rm-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.rm-card-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--rm-primary);
}

.rm-card-price-period {
    font-size: 12px;
    font-weight: 400;
    color: var(--rm-text-muted);
}

.rm-card-availability {
    display: inline-block;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.rm-avail-high {
    background: #e6f4ea;
    color: #137333;
}

.rm-avail-medium {
    background: #fef7e0;
    color: #8a6d1b;
}

.rm-avail-low {
    background: #fce8e6;
    color: #c5221f;
}

/* Quantity selector on equipment card */
.rm-card-qty {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-top: 10px;
    border-top: 1px solid var(--rm-border);
}

.rm-qty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 16px;
    font-weight: 700;
    color: var(--rm-primary);
    background: var(--rm-primary-light);
    border: 1px solid var(--rm-primary);
    border-radius: var(--rm-radius);
    cursor: pointer;
    transition: background var(--rm-transition);
    padding: 0;
    line-height: 1;
}

.rm-qty-btn:hover {
    background: var(--rm-primary);
    color: #ffffff;
}

.rm-qty-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.rm-qty-value {
    display: inline-block;
    width: 36px;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: var(--rm-text);
}

.rm-card-add-btn {
    margin-left: auto;
}

/* ── Add-ons Container ──────────────────────────────────────────────────── */
.rm-addons-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.rm-addon-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    background: var(--rm-bg);
    border: 1px solid var(--rm-border);
    border-radius: var(--rm-radius);
    cursor: pointer;
    transition: border-color var(--rm-transition), box-shadow var(--rm-transition);
}

.rm-addon-card:hover {
    border-color: var(--rm-primary);
}

.rm-addon-card.rm-addon-selected {
    border-color: var(--rm-primary);
    background: var(--rm-primary-light);
}

.rm-addon-checkbox {
    flex-shrink: 0;
    margin-top: 2px;
    accent-color: var(--rm-primary);
}

.rm-addon-info {
    flex: 1;
    min-width: 0;
}

.rm-addon-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--rm-text);
    margin-bottom: 2px;
}

.rm-addon-price {
    font-size: 13px;
    color: var(--rm-primary);
    font-weight: 500;
}

.rm-addon-description {
    font-size: 12px;
    color: var(--rm-text-muted);
    margin-top: 2px;
}

/* ── Promo Code ─────────────────────────────────────────────────────────── */
.rm-promo-row {
    display: flex;
    gap: 10px;
    max-width: 420px;
    margin-bottom: 12px;
}

.rm-promo-row input[type="text"] {
    flex: 1;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid var(--rm-border);
    border-radius: var(--rm-radius);
    box-sizing: border-box;
    transition: border-color var(--rm-transition), box-shadow var(--rm-transition);
}

.rm-promo-row input[type="text"]:focus {
    outline: none;
    border-color: var(--rm-primary);
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.15);
}

.rm-promo-result {
    margin-bottom: 8px;
}

.rm-promo-result .rm-promo-success {
    padding: 10px 14px;
    background: #e6f4ea;
    color: #137333;
    border-radius: var(--rm-radius);
    font-size: 14px;
    font-weight: 500;
}

.rm-promo-result .rm-promo-error {
    padding: 10px 14px;
    background: #fce8e6;
    color: #c5221f;
    border-radius: var(--rm-radius);
    font-size: 14px;
    font-weight: 500;
}

.rm-promo-skip-note {
    color: var(--rm-text-muted);
    font-size: 13px;
    margin: 0;
}

/* ── Price Summary ──────────────────────────────────────────────────────── */
.rm-price-summary {
    margin-bottom: 16px;
}

.rm-price-summary table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.rm-price-summary th,
.rm-price-summary td {
    padding: 10px 0;
    border-bottom: 1px solid var(--rm-border);
    text-align: left;
}

.rm-price-summary th {
    font-weight: 600;
    color: var(--rm-text);
}

.rm-price-summary td {
    color: var(--rm-text);
}

.rm-price-summary td:last-child {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.rm-price-summary .rm-price-line-item td {
    color: var(--rm-text-muted);
    font-size: 13px;
    padding: 6px 0 6px 16px;
    border-bottom: none;
}

.rm-price-summary .rm-price-discount td {
    color: var(--rm-success);
    font-weight: 500;
}

.rm-price-summary .rm-price-total td {
    font-size: 18px;
    font-weight: 700;
    color: var(--rm-text);
    border-bottom: none;
    border-top: 2px solid var(--rm-text);
    padding-top: 14px;
}

/* ── Processing / Spinner ───────────────────────────────────────────────── */
.rm-processing {
    text-align: center;
    padding: 60px 20px;
}

.rm-processing h3 {
    margin-top: 20px;
    border: none;
}

.rm-processing p {
    color: var(--rm-text-muted);
    font-size: 14px;
}

.rm-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid var(--rm-border);
    border-top-color: var(--rm-primary);
    border-radius: 50%;
    animation: rm-spin 0.7s linear infinite;
}

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

/* ── Progress Bar ───────────────────────────────────────────────────────── */
.rm-progress {
    padding: 16px 32px 20px;
    background: var(--rm-bg-light);
    border-top: 1px solid var(--rm-border);
}

.rm-progress-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.rm-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.rm-progress-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    font-size: 12px;
    font-weight: 700;
    color: var(--rm-text-muted);
    background: var(--rm-bg);
    border: 2px solid var(--rm-border);
    border-radius: 50%;
    transition: all var(--rm-transition);
}

.rm-progress-label {
    font-size: 11px;
    color: var(--rm-text-muted);
    text-align: center;
    transition: color var(--rm-transition);
}

.rm-progress-step-active .rm-progress-dot {
    background: var(--rm-primary);
    border-color: var(--rm-primary);
    color: #ffffff;
}

.rm-progress-step-active .rm-progress-label {
    color: var(--rm-primary);
    font-weight: 600;
}

.rm-progress-step-completed .rm-progress-dot {
    background: var(--rm-success);
    border-color: var(--rm-success);
    color: #ffffff;
}

.rm-progress-step-completed .rm-progress-label {
    color: var(--rm-success);
}

.rm-progress-bar-track {
    width: 100%;
    height: 4px;
    background: var(--rm-border);
    border-radius: 2px;
    overflow: hidden;
}

.rm-progress-bar {
    height: 100%;
    background: var(--rm-primary);
    border-radius: 2px;
    transition: width 0.4s ease;
}

/* ── Substitute Suggestion ──────────────────────────────────────────────── */
.rm-substitute-suggestion {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    margin: 10px 0;
    background: #fef7e0;
    border: 1px solid var(--rm-warning);
    border-radius: var(--rm-radius);
    font-size: 13px;
    color: #6d5603;
}

.rm-substitute-suggestion::before {
    content: "\26A0";
    font-size: 16px;
    flex-shrink: 0;
}

.rm-substitute-link {
    color: var(--rm-primary);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

/* ── Error / Notices ────────────────────────────────────────────────────── */
.rm-error {
    padding: 12px 16px;
    background: #fce8e6;
    color: #c5221f;
    border: 1px solid var(--rm-danger);
    border-radius: var(--rm-radius);
    font-size: 14px;
}

.rm-notice {
    padding: 12px 16px;
    background: var(--rm-primary-light);
    color: var(--rm-primary);
    border: 1px solid var(--rm-primary);
    border-radius: var(--rm-radius);
    font-size: 14px;
    margin-bottom: 12px;
}

.rm-loading {
    text-align: center;
    color: var(--rm-text-muted);
    padding: 60px 0;
    font-size: 0.95rem;
}
.rm-loading::before {
    content: '';
    display: block;
    width: 36px;
    height: 36px;
    border: 3px solid var(--rm-border);
    border-top-color: var(--rm-primary);
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: rm-spin 0.8s linear infinite;
}
@keyframes rm-spin {
    to { transform: rotate(360deg); }
}

/* ── Availability Calendar ──────────────────────────────────────────────── */
.rm-availability-calendar {
    max-width: 520px;
    margin: 2rem auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 14px;
    color: var(--rm-text);
    background: var(--rm-bg);
    border: 1px solid var(--rm-border);
    border-radius: var(--rm-radius);
    box-shadow: var(--rm-shadow);
    overflow: hidden;
}

.rm-cal-header {
    padding: 16px 20px;
    background: var(--rm-bg-light);
    border-bottom: 1px solid var(--rm-border);
}

.rm-cal-title {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--rm-text);
}

.rm-cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rm-cal-prev,
.rm-cal-next {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 20px;
    font-weight: 700;
    color: var(--rm-text);
    background: var(--rm-bg);
    border: 1px solid var(--rm-border);
    border-radius: var(--rm-radius);
    cursor: pointer;
    transition: background var(--rm-transition), border-color var(--rm-transition);
    padding: 0;
    line-height: 1;
}

.rm-cal-prev:hover,
.rm-cal-next:hover {
    background: var(--rm-primary-light);
    border-color: var(--rm-primary);
    color: var(--rm-primary);
}

.rm-cal-month-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--rm-text);
}

.rm-cal-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.rm-cal-table th {
    padding: 10px 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--rm-text-muted);
    text-align: center;
    background: var(--rm-bg-light);
    border-bottom: 1px solid var(--rm-border);
}

.rm-cal-table td {
    padding: 8px 4px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid var(--rm-bg-light);
}

.rm-cal-empty {
    background: var(--rm-bg);
}

.rm-cal-day {
    cursor: default;
}

.rm-cal-past {
    color: var(--rm-border);
    background: var(--rm-bg);
}

.rm-cal-available {
    background: #e6f4ea;
    color: #137333;
}

.rm-cal-limited {
    background: #fef7e0;
    color: #8a6d1b;
}

.rm-cal-unavailable {
    background: #fce8e6;
    color: #c5221f;
}

/* Calendar legend */
.rm-cal-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 12px 16px;
    background: var(--rm-bg-light);
    border-top: 1px solid var(--rm-border);
}

.rm-cal-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--rm-text-muted);
}

.rm-cal-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.rm-cal-swatch-available {
    background: #e6f4ea;
}

.rm-cal-swatch-limited {
    background: #fef7e0;
}

.rm-cal-swatch-unavailable {
    background: #fce8e6;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .rm-booking-widget {
        margin: 1rem;
        border-radius: 0;
    }

    .rm-step {
        padding: 20px 16px;
    }

    .rm-form-row {
        flex-direction: column;
        gap: 12px;
    }

    .rm-rental-type-row {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .rm-equipment-grid {
        grid-template-columns: 1fr;
    }

    .rm-addons-container {
        grid-template-columns: 1fr;
    }

    .rm-promo-row {
        flex-direction: column;
        max-width: 100%;
    }

    .rm-step-nav {
        gap: 10px;
    }

    .rm-btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    .rm-progress {
        padding: 12px 16px 16px;
    }

    .rm-progress-steps {
        gap: 2px;
    }

    .rm-progress-label {
        font-size: 10px;
    }

    .rm-progress-dot {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }

    .rm-category-filter {
        gap: 6px;
    }

    .rm-cat-btn {
        padding: 5px 12px;
        font-size: 12px;
    }

    /* Availability calendar */
    .rm-availability-calendar {
        margin: 1rem;
    }

    .rm-cal-legend {
        flex-wrap: wrap;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .rm-card-image,
    .rm-card-placeholder-img {
        height: 140px;
    }

    .rm-step-title {
        font-size: 1.1em;
    }

    .rm-progress-label {
        display: none;
    }
}
