/**
 * Finnkone Koulutusvaraukset – Frontend styles
 */

/* =========================================================================
   TEEMAN OSTOBLOKIN PIILOTUS – vain koulutustuotesivuilla
   ========================================================================= */

body.fnk-is-training-product .sp-add-to-cart,
body.fnk-is-training-product .sp-stock-badge,
body.fnk-is-training-product .sp-price-block__vat-toggle,
body.fnk-is-training-product .sp-add-to-cart.fnk-replaced {
    display: none !important;
}

/* Varmistetaan että lomakkeen lähdeelementti ei näy ennen injektiota */
#fnk-booking-source {
    display: none !important;
}

/* =========================================================================
   WRAPPER
   ========================================================================= */

.fnk-booking {
    margin: 24px 0;
    padding: 28px;
    background: var(--white, #fff);
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: var(--radius, 12px);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,.06));
    font-size: 16px;
}

.fnk-booking-header h3 {
    margin: 0 0 6px;
    color: var(--navy, #0a1f44);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
}

.fnk-booking-sub {
    margin: 0 0 8px;
    color: var(--gray-600, #525866);
    font-size: 15px;
    line-height: 1.5;
}

.fnk-booking-time {
    margin: 0 0 20px;
    color: var(--navy, #0a1f44);
    font-size: 15px;
}

/* =========================================================================
   EI PÄIVIÄ ASETETTU
   ========================================================================= */

.fnk-no-dates-info {
    margin: 0 0 20px;
    padding: 16px 18px;
    background: var(--gray-50, #f6f8fa);
    border-left: 3px solid var(--navy, #0a1f44);
    border-radius: 4px;
}

.fnk-no-dates-info p {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    color: var(--gray-700, #394150);
}

/* =========================================================================
   KALENTERI
   ========================================================================= */

.fnk-calendar-section {
    margin: 0 0 24px;
}

.fnk-field-label {
    display: block;
    margin-bottom: 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--navy, #0a1f44);
}

.fnk-calendar {
    background: var(--gray-50, #f6f8fa);
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: var(--radius, 12px);
    padding: 16px;
    user-select: none;
}

.fnk-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.fnk-cal-title {
    flex: 1;
    text-align: center;
    font-size: 17px;
    font-weight: 700;
    color: var(--navy, #0a1f44);
    text-transform: capitalize;
}

.fnk-cal-nav {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--white, #fff);
    color: var(--navy, #0a1f44);
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: 50%;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
    line-height: 1;
    padding: 0;
}

.fnk-cal-nav:hover {
    background: var(--navy, #0a1f44);
    color: var(--white, #fff);
    border-color: var(--navy, #0a1f44);
}

.fnk-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 4px;
}

.fnk-cal-weekday {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500, #6b7280);
    padding: 8px 0;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.fnk-cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.fnk-cal-day {
    position: relative;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    font: inherit;
    font-size: 15px;
    color: var(--gray-400, #9ca3af);
    cursor: default;
    padding: 0;
    transition: background .15s ease, border-color .15s ease, transform .1s ease;
    min-height: 44px;
}

.fnk-cal-day.fnk-cal-empty {
    pointer-events: none;
}

.fnk-cal-day.is-past,
.fnk-cal-day.is-unavailable {
    color: var(--gray-300, #d1d5db);
    cursor: default;
}

.fnk-cal-day.is-available {
    background: var(--white, #fff);
    border-color: var(--gray-200, #e5e7eb);
    color: var(--navy, #0a1f44);
    font-weight: 500;
    cursor: pointer;
}

.fnk-cal-day.is-available:hover:not(.is-full):not(.is-selected) {
    background: var(--navy, #0a1f44);
    color: var(--white, #fff);
    border-color: var(--navy, #0a1f44);
    transform: translateY(-1px);
}

.fnk-cal-day.is-limited {
    border-color: #f59e0b;
    background: #fffbeb;
}

.fnk-cal-day.is-limited:hover:not(.is-selected) {
    background: #f59e0b !important;
    color: var(--white, #fff) !important;
    border-color: #f59e0b !important;
}

.fnk-cal-day.is-full {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
    cursor: not-allowed;
}

.fnk-cal-day.is-selected {
    background: var(--navy, #0a1f44);
    color: var(--white, #fff);
    border-color: var(--navy, #0a1f44);
    font-weight: 700;
    box-shadow: 0 0 0 2px rgba(10,31,68,.2);
}

.fnk-cal-day:focus {
    outline: 0;
    box-shadow: 0 0 0 2px rgba(10,31,68,.4);
}

.fnk-cal-daynum {
    line-height: 1;
}

.fnk-cal-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: .3px;
    line-height: 1.2;
}

.fnk-cal-badge-full {
    background: #991b1b;
    color: var(--white, #fff);
}

/* =========================================================================
   LEGEND
   ========================================================================= */

.fnk-cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--gray-200, #e5e7eb);
    font-size: 13px;
    color: var(--gray-600, #525866);
}

.fnk-cal-legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    margin-right: 6px;
    vertical-align: -2px;
    border: 1px solid var(--gray-200, #e5e7eb);
}

.fnk-cal-legend-dot.is-available {
    background: var(--white, #fff);
    border-color: var(--navy, #0a1f44);
}

.fnk-cal-legend-dot.is-limited {
    background: #fffbeb;
    border-color: #f59e0b;
}

.fnk-cal-legend-dot.is-full {
    background: #fef2f2;
    border-color: #fecaca;
}

/* =========================================================================
   VALINNAN INFO
   ========================================================================= */

.fnk-selected-info {
    margin-top: 12px;
    padding: 12px 16px;
    background: var(--gray-50, #f6f8fa);
    border-radius: 8px;
    color: var(--gray-600, #525866);
    font-size: 14px;
    line-height: 1.5;
}

.fnk-selected-info.has-selection {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.fnk-selected-info strong {
    color: inherit;
    font-size: 15px;
}

.fnk-selected-label {
    opacity: .8;
}

.fnk-selected-capacity {
    font-size: 13px;
    opacity: .9;
}

.fnk-selected-placeholder {
    font-style: italic;
}

/* =========================================================================
   LOMAKE
   ========================================================================= */

.fnk-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
    margin-bottom: 20px;
}

.fnk-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.fnk-field-full {
    grid-column: 1 / -1;
}

.fnk-field label {
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--navy, #0a1f44);
}

.fnk-field .req {
    color: var(--orange, #d04500);
    margin-left: 2px;
}

.fnk-field input[type="text"],
.fnk-field input[type="email"],
.fnk-field input[type="tel"],
.fnk-field input[type="number"],
.fnk-field textarea {
    width: 100%;
    padding: 11px 14px;
    background: var(--white, #fff);
    border: 1px solid var(--gray-300, #d1d5db);
    border-radius: 8px;
    font: inherit;
    font-size: 16px;
    color: var(--navy, #0a1f44);
    transition: border-color .15s ease, box-shadow .15s ease;
    box-sizing: border-box;
}

.fnk-field input:focus,
.fnk-field textarea:focus {
    outline: 0;
    border-color: var(--navy, #0a1f44);
    box-shadow: 0 0 0 3px rgba(10, 31, 68, .1);
}

.fnk-field textarea {
    resize: vertical;
    min-height: 88px;
    font-family: inherit;
}

.fnk-field-hint {
    display: block;
    margin-top: 5px;
    font-size: 13px;
    color: var(--gray-500, #6b7280);
    min-height: 18px;
}

.fnk-field-hint.is-error {
    color: #991b1b;
    font-weight: 500;
}

/* =========================================================================
   CHECKBOX
   ========================================================================= */

.fnk-checkbox {
    display: flex !important;
    align-items: flex-start;
    gap: 10px;
    font-weight: 500 !important;
    color: var(--gray-700, #394150) !important;
    cursor: pointer;
    line-height: 1.4;
    margin-bottom: 0 !important;
}

.fnk-checkbox input[type="checkbox"] {
    margin-top: 3px;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    accent-color: var(--navy, #0a1f44);
}

/* =========================================================================
   CTA
   ========================================================================= */

.fnk-actions {
    margin-top: 4px;
}

.fnk-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 15px 32px;
    background: var(--orange, #d04500);
    color: var(--white, #fff);
    border: 0;
    border-radius: var(--pill, 50px);
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, transform .1s ease;
}

.fnk-submit:hover:not(:disabled) {
    background: #b83d00;
}

.fnk-submit:active:not(:disabled) {
    transform: translateY(1px);
}

.fnk-submit:disabled {
    opacity: .6;
    cursor: not-allowed;
}

/* =========================================================================
   PALAUTE
   ========================================================================= */

.fnk-feedback {
    margin-top: 16px;
    padding: 0;
    font-size: 15px;
    line-height: 1.5;
}

.fnk-feedback.success {
    padding: 14px 16px;
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
}

.fnk-feedback.error {
    padding: 14px 16px;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 8px;
}

/* =========================================================================
   EHDOT
   ========================================================================= */

.fnk-terms {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--gray-200, #e5e7eb);
}

.fnk-terms p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--gray-500, #6b7280);
}

/* =========================================================================
   MOBIILI
   ========================================================================= */

@media (max-width: 640px) {
    .fnk-booking {
        padding: 20px 16px;
    }

    .fnk-grid {
        grid-template-columns: 1fr;
    }

    .fnk-calendar {
        padding: 12px;
    }

    .fnk-cal-day {
        font-size: 14px;
        min-height: 40px;
    }

    .fnk-cal-badge {
        font-size: 8px;
    }

    .fnk-cal-title {
        font-size: 15px;
    }

    .fnk-submit {
        width: 100%;
        padding: 16px 24px;
    }

    .fnk-cal-legend {
        flex-direction: column;
        gap: 6px;
    }
}

/* =========================================================================
   REDUCED MOTION
   ========================================================================= */

@media (prefers-reduced-motion: reduce) {
    .fnk-cal-day,
    .fnk-cal-nav,
    .fnk-submit,
    .fnk-field input,
    .fnk-field textarea {
        transition: none;
    }
}
