
/* KSM Event Manager Frontend Styles */

/* theme variables with fallbacks to match main KSM look */
:root {
    --ksm-primary: var(--primary, #2271b1);
    --ksm-primary-dark: var(--primary-dark, #135e96);
    --ksm-text: var(--text, #1d2327);
    --ksm-muted: #64748b;
    --ksm-card-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

/* Event Cards (matching main KSM card style) */
.ksm-events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin: 30px 0;
}

.ksm-event-card {
    background: #fff;
    border: 1px solid #e8eef6;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.28s ease, box-shadow 0.28s ease;
    box-shadow: var(--ksm-card-shadow);
}

.ksm-event-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 40px rgba(0,0,0,0.12);
}

.ksm-event-thumbnail {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
}

.ksm-event-content {
    padding: 24px;
}

.ksm-event-title {
    margin: 0 0 10px;
    font-size: 22px;
    color: var(--ksm-primary);
    font-weight: 600;
}

.ksm-event-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 14px 0;
    font-size: 14px;
    color: var(--ksm-muted);
}

.ksm-event-date,
.ksm-event-location,
.ksm-event-capacity {
    display: flex;
    align-items: center;
    gap: 5px;
}

.ksm-event-date::before {
    content: "📅";
}

.ksm-event-location::before {
    content: "📍";
}

.ksm-event-capacity::before {
    content: "👥";
}

.ksm-event-excerpt {
    margin: 15px 0;
    color: #555;
    line-height: 1.6;
}

.ksm-event-footer {
    border-top: 1px solid #f0f0f0;
    padding-top: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ksm-event-price {
    font-size: 18px;
    font-weight: bold;
    color: #2271b1;
}

/* Booking Form */
.ksm-booking-section {
    background: #f9f9f9;
    padding: 30px;
    border-radius: 8px;
    margin: 30px 0;
}

.ksm-booking-form {
    max-width: 600px;
}

.ksm-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.ksm-form-field {
    margin-bottom: 20px;
}

.ksm-form-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.ksm-form-field .required {
    color: #d63638;
}

.ksm-input,
.ksm-select,
.ksm-textarea {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    line-height: 1.4;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

/* Increase specificity for booking form fields in case theme CSS overrides input sizing */
.ksm-booking-form .ksm-input,
.ksm-booking-form .ksm-select,
.ksm-booking-form .ksm-textarea {
    font-size: 16px;
    line-height: 1.4;
    font-family: inherit;
}

/* Stronger override to beat theme/Elementor rules */
.ksm-booking-form input,
.ksm-booking-form textarea,
.ksm-booking-form select,
.ksm-booking-section input,
.ksm-booking-section textarea,
.ksm-booking-section select,
.ksm-booking-form .ksm-input,
.ksm-booking-form .ksm-textarea,
.ksm-booking-form .ksm-select {
    font-size: 16px !important;
    line-height: 1.4 !important;
    font-family: inherit !important;
}

/* Placeholder sizing */
.ksm-booking-form ::placeholder,
.ksm-booking-section ::placeholder {
    font-size: 16px !important;
}

.ksm-input:focus,
.ksm-select:focus,
.ksm-textarea:focus {
    outline: none;
    border-color: #2271b1;
}

.ksm-booking-summary {
    background: #fff;
    padding: 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.total-amount {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 18px;
}

.total-amount .amount {
    color: #2271b1;
    font-size: 24px;
}

.ksm-button {
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.ksm-button-primary {
    background-color: #2271b1;
    color: #fff;
}

.ksm-button-primary:hover {
    background-color: #135e96;
}

/* Event Details Box */
.ksm-event-details-box {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    margin: 30px 0;
}

.ksm-event-details-box h3 {
    margin-top: 0;
    color: #333;
}

.ksm-detail-item {
    display: flex;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.ksm-detail-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.ksm-detail-label {
    font-weight: 600;
    min-width: 120px;
    color: #666;
}

.ksm-detail-value {
    color: #333;
}

.ksm-remaining-seats {
    color: #d63638;
    font-weight: bold;
}

.ksm-remaining-seats.available {
    color: #00a32a;
}

/* Calendar */
.ksm-calendar-container {
    margin: 30px 0;
}

/* Countdown Timer */
.ksm-countdown {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
}

.ksm-countdown-item {
    text-align: center;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    min-width: 80px;
}

.ksm-countdown-number {
    font-size: 36px;
    font-weight: bold;
    color: #2271b1;
    display: block;
}

.ksm-countdown-label {
    font-size: 14px;
    color: #666;
    text-transform: uppercase;
    margin-top: 5px;
}

/* Alerts */
.ksm-alert {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.ksm-alert-warning {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
}

.ksm-alert-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.ksm-alert-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Responsive */
@media (max-width: 768px) {
    .ksm-events-grid {
        grid-template-columns: 1fr;
    }
    
    .ksm-form-row {
        grid-template-columns: 1fr;
    }
    
    .ksm-countdown {
        flex-wrap: wrap;
    }
}

/* Ticket Cards (booking form) */
.ksm-ticket-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-top: 12px;
}

.ksm-ticket-card {
    background: #fff;
    border: 1px solid #e6eef8;
    border-radius: 10px;
    padding: 14px;
    box-shadow: 0 6px 18px rgba(16,24,40,0.04);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ksm-ticket-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ksm-ticket-name {
    font-weight: 700;
    color: var(--ksm-text);
}

.ksm-ticket-price {
    color: var(--ksm-primary);
    font-weight: 700;
}

.ksm-ticket-desc {
    color: #555;
    font-size: 13px;
    line-height: 1.4;
}

.ksm-ticket-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
}

.ksm-ticket-qty {
    width: 56px;
    padding: 8px 10px;
    text-align: center;
    border: 1px solid #e0e6ef;
    border-radius: 6px;
}

.ksm-ticket-increase,
.ksm-ticket-decrease {
    background: transparent;
    border: 1px solid #dbe8f7;
    border-radius: 6px;
    width: 36px;
    height: 36px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: var(--ksm-primary);
}

.ksm-ticket-increase:hover,
.ksm-ticket-decrease:hover {
    background: rgba(34,113,177,0.06);
}

@media (max-width: 480px) {
    .ksm-ticket-controls { gap: 6px; }
    .ksm-ticket-qty { width: 48px; }
}

/* ── Payment Method Cards ───────────────────────────────────────────────────── */

.ksm-payment-method-field > label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
}

.ksm-payment-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 0;
}

.ksm-payment-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: #fff;
    border: 2px solid #e6eef8;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    user-select: none;
}

.ksm-payment-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ksm-payment-card:hover {
    border-color: var(--ksm-primary, #2271b1);
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.08);
}

.ksm-payment-card.is-active {
    border-color: var(--ksm-primary, #2271b1);
    background: #f0f6ff;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.12);
}

.ksm-payment-card-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    line-height: 0;
    border-radius: 4px;
    overflow: hidden;
}

.ksm-payment-card-label {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 14px;
    color: #1d2327;
}

.ksm-payment-card-label strong {
    font-size: 15px;
}

.ksm-payment-card-label span {
    color: #64748b;
    font-size: 13px;
}

.ksm-payment-card-check {
    flex-shrink: 0;
    color: #e0e6ef;
    transition: color 0.2s ease;
    line-height: 0;
}

.ksm-payment-card.is-active .ksm-payment-card-check {
    color: var(--ksm-primary, #2271b1);
}

/* ── Inline Payment Panels ──────────────────────────────────────────────────── */

.ksm-payment-panel {
    display: none;
    margin-top: 12px;
    border-radius: 8px;
    overflow: hidden;
    animation: ksmPanelIn 0.2s ease;
}

@keyframes ksmPanelIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ksm-payment-panel.is-visible {
    display: block;
}

/* ── Stripe panel ───────────────────────────────────────────────────────────── */

.ksm-stripe-wrapper {
    background: #fff;
    border: 1px solid #e0e6ef;
    border-radius: 8px;
    padding: 18px;
}

.ksm-stripe-field label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.ksm-stripe-element {
    padding: 11px 14px;
    border: 1px solid #dce1ea;
    border-radius: 6px;
    background: #fafbfc;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ksm-stripe-element.StripeElement--focus {
    border-color: var(--ksm-primary, #2271b1);
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.12);
    outline: none;
    background: #fff;
}

.ksm-stripe-element.StripeElement--invalid {
    border-color: #d63638;
}

.ksm-stripe-errors {
    color: #d63638;
    font-size: 13px;
    margin-top: 8px;
    min-height: 18px;
}

.ksm-stripe-secure {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 10px;
    font-size: 12px;
    color: #64748b;
}

/* ── PayPal panel ───────────────────────────────────────────────────────────── */

.ksm-payment-panel--paypal {
    background: #fff;
    border: 1px solid #e0e6ef;
    border-radius: 8px;
    padding: 18px;
}

#ksm-paypal-button-container {
    margin-bottom: 10px;
}

.ksm-paypal-note {
    margin: 0;
    font-size: 13px;
    color: #64748b;
    text-align: center;
}

/* ── Offline / Pay at venue panel ───────────────────────────────────────────── */

.ksm-offline-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    background: #fff8e6;
    border: 1px solid #ffe58f;
    border-radius: 8px;
    font-size: 14px;
    color: #5a4000;
    line-height: 1.5;
}

.ksm-offline-notice svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: #c07e00;
}

/* ── PayPal button hidden when PayPal is active (submit handled by SDK) ─────── */

.ksm-form-submit.ksm-paypal-active {
    display: none !important;
}

@media (max-width: 600px) {
    .ksm-payment-cards {
        gap: 8px;
    }
    .ksm-payment-card {
        padding: 12px 14px;
    }
}

/* Toast notifications */
#ksm-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.ksm-toast {
    min-width: 260px;
    max-width: 380px;
    padding: 12px 16px;
    border-radius: 10px;
    color: #fff;
    box-shadow: 0 12px 30px rgba(0,0,0,0.18);
    transform: translateY(-8px);
    opacity: 0;
    transition: transform 0.18s ease, opacity 0.18s ease;
    pointer-events: auto;
}
.ksm-toast-show { transform: translateY(0); opacity: 1; }
.ksm-toast-info { background: #2563eb; }
.ksm-toast-success { background: #16a34a; }
.ksm-toast-error { background: #ef4444; }
.ksm-toast-warning { background: #f59e0b; color: #111; }

/* Fullscreen centered modal toast */
#ksm-toast-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.72);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100000;
}
#ksm-toast-overlay.ksm-toast-overlay-show { display: flex; }
.ksm-toast-modal {
    max-width: 760px;
    width: calc(100% - 64px);
    background: #fff;
    color: #111;
    border-radius: 12px;
    padding: 28px 26px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6);
    transform: translateY(-8px) scale(0.98);
    opacity: 0;
    transition: transform 0.22s ease, opacity 0.22s ease;
    text-align: center;
}
.ksm-toast-modal-show { transform: translateY(0) scale(1); opacity: 1; }
.ksm-toast-modal .ksm-toast-modal-inner { font-size: 18px; line-height: 1.4; }
.ksm-toast-modal-warning { background: #fff8e6; }
.ksm-toast-modal-error { background: #fff6f6; color: #7a1a1a; }
.ksm-toast-modal-success { background: #f6fffb; }

/* Modal close button */
.ksm-toast-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0,0,0,0.06);
    color: #111;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.ksm-toast-modal-close:hover { background: rgba(0,0,0,0.12); }
