/**
 * Målarkompetens Fly-in - Frontend Styles v1.3.0
 */

/* === POPUP === */
.mk-flyin-popup {
    position: fixed;
    right: -400px;
    bottom: 100px;
    width: 340px;
    max-width: calc(100vw - 40px);
    background: var(--mk-bg-color, #ffffff);
    color: var(--mk-text-color, #333333);
    border-radius: var(--mk-border-radius, 12px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 28px;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: right 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.4s ease, visibility 0.4s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    box-sizing: border-box;
    color-scheme: light;
}

.mk-flyin-popup *,
.mk-flyin-popup *::before,
.mk-flyin-popup *::after {
    box-sizing: border-box;
}

.mk-flyin-popup.is-visible {
    right: 20px;
    opacity: 1;
    visibility: visible;
}

/* === STÄNG-KNAPP === */
.mk-flyin-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    color: var(--mk-text-color, #333333);
    opacity: 0.6;
    transition: opacity 0.2s ease, background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.mk-flyin-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.1);
}

/* === RUBRIK & TEXT === */
.mk-flyin-heading {
    margin: 0 0 12px 0;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.3;
    color: inherit;
    padding-right: 30px;
}

.mk-flyin-text {
    margin: 0 0 20px 0;
    font-size: 15px;
    line-height: 1.6;
    color: inherit;
    opacity: 0.85;
}

/* === FORMULÄR === */
.mk-flyin-form {
    margin-bottom: 16px;
}

.mk-flyin-field {
    margin-bottom: 12px;
}

.mk-flyin-popup .mk-flyin-field input[type="text"],
.mk-flyin-popup .mk-flyin-field input[type="tel"],
.mk-flyin-popup .mk-flyin-field input[type="email"],
.mk-flyin-popup .mk-flyin-field textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    color: #333333 !important;
    background-color: #ffffff !important;
    background: #ffffff !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    color-scheme: light;
}

.mk-flyin-popup .mk-flyin-field textarea {
    min-height: 80px;
    max-height: 150px;
    resize: vertical;
    line-height: 1.5;
}

.mk-flyin-popup .mk-flyin-field input::placeholder,
.mk-flyin-popup .mk-flyin-field textarea::placeholder {
    color: #999999 !important;
    opacity: 1;
}

.mk-flyin-popup .mk-flyin-field input:focus,
.mk-flyin-popup .mk-flyin-field textarea:focus {
    outline: none;
    border-color: var(--mk-button-bg, #0073aa);
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.15);
}

.mk-flyin-popup .mk-flyin-field input.is-invalid,
.mk-flyin-popup .mk-flyin-field textarea.is-invalid {
    border-color: #dc3545;
}

/* === SKICKA-KNAPP === */
.mk-flyin-submit {
    width: 100%;
    padding: 14px 20px;
    background: var(--mk-button-bg, #0073aa);
    color: var(--mk-button-text, #ffffff);
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.mk-flyin-submit:hover {
    background: var(--mk-button-bg-hover, #005a87);
    color: var(--mk-button-text-hover, #ffffff);
}

.mk-flyin-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.mk-flyin-submit.is-loading {
    position: relative;
    color: transparent;
}

.mk-flyin-submit.is-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top-color: var(--mk-button-text, #ffffff);
    border-radius: 50%;
    animation: mk-spin 0.8s linear infinite;
}

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

/* === MEDDELANDE (TACK/FEL) === */
.mk-flyin-message {
    display: none;
    margin: 16px 0;
    padding: 12px 16px;
    font-size: 14px;
    text-align: center;
    border-radius: 6px;
}

.mk-flyin-message.is-success {
    display: block;
    color: #155724;
    background: #d4edda;
    border: 1px solid #c3e6cb;
}

.mk-flyin-message.is-error {
    display: block;
    color: #721c24;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
}

/* === CTA-KNAPP === */
.mk-flyin-button {
    display: block;
    width: 100%;
    padding: 14px 20px;
    background: transparent;
    color: var(--mk-button-bg, #0073aa);
    border: 2px solid var(--mk-button-bg, #0073aa);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.mk-flyin-button:hover {
    background: var(--mk-button-bg-hover, #005a87);
    color: var(--mk-button-text-hover, #ffffff);
    border-color: var(--mk-button-bg-hover, #005a87);
}

/* === MINIMERAD FLIK === */
.mk-flyin-tab {
    position: fixed;
    right: -100%;
    bottom: 150px;
    background: var(--mk-button-bg, #0073aa);
    color: var(--mk-button-text, #ffffff);
    padding: 12px 18px;
    border-radius: 0;
    cursor: pointer;
    z-index: 999998;
    box-shadow: -2px 2px 10px rgba(0, 0, 0, 0.15);
    transition: right 0.3s ease, background 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    font-weight: 600;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
}

.mk-flyin-tab:hover {
    background: var(--mk-button-bg-hover, #005a87);
}

.mk-flyin-tab.is-visible {
    right: 0;
}

/* === RESPONSIVT === */
@media (max-width: 480px) {
    .mk-flyin-popup {
        right: -100%;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        max-height: 90vh;
        overflow-y: auto;
        border-radius: var(--mk-border-radius, 12px) var(--mk-border-radius, 12px) 0 0;
        padding: 24px 20px 30px;
    }
    
    .mk-flyin-popup.is-visible {
        right: 0;
    }
    
    .mk-flyin-heading {
        font-size: 20px;
    }
    
    .mk-flyin-tab {
        bottom: 100px;
        padding: 10px 14px;
        font-size: 13px;
    }
}

/* === REDUCERAD RÖRELSE === */
@media (prefers-reduced-motion: reduce) {
    .mk-flyin-popup,
    .mk-flyin-tab {
        transition: opacity 0.2s ease, visibility 0.2s ease;
    }
    
    .mk-flyin-submit.is-loading::after {
        animation: none;
    }
}

/* === PRINT === */
@media print {
    .mk-flyin-popup,
    .mk-flyin-tab {
        display: none !important;
    }
}
