/* ============================================
   WiFi Captive Portal - Frontend Styles
   ============================================ */

/* Reset per il wrapper del plugin */
.wcp-portal-wrapper,
.wcp-portal-wrapper * {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Wrapper principale */
.wcp-portal-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100%;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Container del form */
.wcp-form-container {
    width: 100%;
    max-width: 520px;
    padding: 40px 35px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08), 0 2px 10px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.3s ease;
}

.wcp-form-container:hover {
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.12), 0 4px 15px rgba(0, 0, 0, 0.06);
}

/* Logo */
.wcp-logo {
    text-align: center;
    margin-bottom: 24px;
}

.wcp-logo img {
    max-width: 180px;
    max-height: 80px;
    height: auto;
    object-fit: contain;
}

/* Titolo e sottotitolo */
.wcp-form-title {
    font-size: 26px;
    font-weight: 700;
    text-align: center;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.wcp-form-subtitle {
    font-size: 15px;
    text-align: center;
    margin: 0 0 28px 0;
    opacity: 0.7;
    line-height: 1.5;
}

/* Riga form (per nome e cognome affiancati) */
.wcp-form-row {
    display: flex;
    gap: 14px;
}

.wcp-half {
    flex: 1;
}

/* Gruppo form */
.wcp-form-group {
    margin-bottom: 18px;
}

.wcp-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: inherit;
}

.wcp-required {
    color: #e74c3c;
    font-weight: 700;
}

/* Input fields */
.wcp-form-group input[type="text"],
.wcp-form-group input[type="email"],
.wcp-form-group input[type="tel"] {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    background: #fafafa;
    color: #333;
    transition: all 0.25s ease;
    outline: none;
    font-family: inherit;
}

.wcp-form-group input[type="text"]:focus,
.wcp-form-group input[type="email"]:focus,
.wcp-form-group input[type="tel"]:focus {
    border-color: #0073aa;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.12);
}

.wcp-form-group input[type="text"].wcp-input-valid,
.wcp-form-group input[type="email"].wcp-input-valid,
.wcp-form-group input[type="tel"].wcp-input-valid {
    border-color: #27ae60;
}

.wcp-form-group input[type="text"].wcp-input-error,
.wcp-form-group input[type="email"].wcp-input-error,
.wcp-form-group input[type="tel"].wcp-input-error {
    border-color: #e74c3c;
    background: #fff5f5;
}

.wcp-form-group input::placeholder {
    color: #aaa;
    font-weight: 400;
}

/* Messaggi di errore */
.wcp-error-msg {
    display: block;
    font-size: 12px;
    color: #e74c3c;
    margin-top: 4px;
    min-height: 16px;
    line-height: 1.3;
}

/* Privacy checkbox */
.wcp-privacy-group {
    margin-top: 6px;
}

.wcp-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-weight: 400 !important;
}

.wcp-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #0073aa;
}

.wcp-checkbox-text {
    font-size: 13px;
    line-height: 1.5;
    color: inherit;
    opacity: 0.8;
}

.wcp-checkbox-text a {
    color: #0073aa;
    text-decoration: underline;
}

.wcp-checkbox-text a:hover {
    color: #005177;
}

/* Bottone submit */
.wcp-submit-group {
    margin-top: 24px;
    margin-bottom: 0;
}

.wcp-submit-btn {
    width: 100%;
    padding: 15px 24px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    font-family: inherit;
}

.wcp-submit-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    filter: brightness(1.1);
}

.wcp-submit-btn:not(:disabled):active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.wcp-submit-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    filter: grayscale(0.3);
}

.wcp-submit-btn.wcp-btn-loading {
    pointer-events: none;
}

/* Spinner */
.wcp-spinner {
    animation: wcp-rotate 2s linear infinite;
    width: 22px;
    height: 22px;
}

.wcp-spinner .path {
    stroke: currentColor;
    stroke-linecap: round;
    animation: wcp-dash 1.5s ease-in-out infinite;
}

@keyframes wcp-rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes wcp-dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* Container successo */
.wcp-success-container {
    text-align: center;
    padding: 20px 0;
    animation: wcp-fadeIn 0.5s ease;
}

@keyframes wcp-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wcp-success-icon {
    margin-bottom: 20px;
}

/* Checkmark animato */
.wcp-checkmark {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: inline-block;
    stroke-width: 2;
    stroke: #27ae60;
    stroke-miterlimit: 10;
    animation: wcp-fill 0.4s ease-in-out 0.4s forwards, wcp-scale 0.3s ease-in-out 0.9s both;
}

.wcp-checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke: #27ae60;
    fill: none;
    animation: wcp-stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.wcp-checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: wcp-stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes wcp-stroke {
    100% {
        stroke-dashoffset: 0;
    }
}

@keyframes wcp-scale {
    0%, 100% {
        transform: none;
    }
    50% {
        transform: scale3d(1.1, 1.1, 1);
    }
}

@keyframes wcp-fill {
    100% {
        box-shadow: inset 0 0 0 30px rgba(39, 174, 96, 0.08);
    }
}

.wcp-success-message {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 16px 0;
    color: #27ae60;
}

.wcp-wifi-qr {
    margin: 20px auto;
}

.wcp-wifi-qr canvas,
.wcp-wifi-qr img {
    max-width: 200px;
    height: auto;
    border-radius: 8px;
}

.wcp-redirect-notice {
    font-size: 13px;
    opacity: 0.6;
    margin-top: 16px;
    font-style: italic;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 600px) {
    .wcp-portal-wrapper {
        padding: 12px;
    }

    .wcp-form-container {
        padding: 28px 20px;
        border-radius: 12px;
    }

    .wcp-form-row {
        flex-direction: column;
        gap: 0;
    }

    .wcp-form-title {
        font-size: 22px;
    }

    .wcp-form-subtitle {
        font-size: 14px;
    }

    .wcp-submit-btn {
        padding: 14px 20px;
        font-size: 15px;
    }
}

@media (max-width: 380px) {
    .wcp-form-container {
        padding: 20px 16px;
    }

    .wcp-form-title {
        font-size: 20px;
    }
}

/* ============================================
   Credenziali WiFi copiabili
   ============================================ */

.wcp-wifi-credentials {
    margin-top: 24px;
    padding: 24px;
    background: #f0f7ff;
    border: 2px solid #d0e3f7;
    border-radius: 14px;
    text-align: left;
}

.wcp-wifi-cred-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 4px 0;
    color: #1a3a5c;
    text-align: center;
}

.wcp-wifi-cred-subtitle {
    font-size: 13px;
    color: #5a7a9a;
    margin: 0 0 20px 0;
    text-align: center;
}

.wcp-wifi-cred-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fff;
    border-radius: 10px;
    margin-bottom: 10px;
    border: 1px solid #e0ecf5;
}

.wcp-wifi-cred-row:last-of-type {
    margin-bottom: 0;
}

.wcp-wifi-cred-label {
    font-size: 12px;
    font-weight: 600;
    color: #5a7a9a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    margin-right: 12px;
}

.wcp-wifi-cred-value-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wcp-wifi-cred-value {
    font-size: 16px;
    font-weight: 700;
    color: #1a3a5c;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
    user-select: all;
    -webkit-user-select: all;
}

.wcp-copy-credential {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid #d0e3f7;
    border-radius: 8px;
    background: #f0f7ff;
    color: #3a7bd5;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0;
}

.wcp-copy-credential:hover {
    background: #3a7bd5;
    color: #fff;
    border-color: #3a7bd5;
}

.wcp-copy-credential.wcp-copied {
    background: #27ae60;
    color: #fff;
    border-color: #27ae60;
}

/* Stato connessione in corso */
.wcp-connecting-state {
    text-align: center;
    padding: 30px 20px;
}

.wcp-connecting-spinner {
    margin-bottom: 16px;
}

.wcp-connecting-spinner .wcp-spinner {
    width: 40px;
    height: 40px;
}

.wcp-connecting-text {
    font-size: 16px;
    font-weight: 600;
    color: #3a7bd5;
    margin: 0;
}

/* Stato connesso */
.wcp-connected-state {
    text-align: center;
    padding: 20px;
}

.wcp-connected-icon {
    margin-bottom: 12px;
}

.wcp-connected-text {
    font-size: 18px;
    font-weight: 600;
    color: #27ae60;
    margin: 0 0 4px 0;
}

.wcp-connected-subtext {
    font-size: 14px;
    color: #666;
    margin: 0;
}

/* Istruzioni connessione */
.wcp-wifi-instructions {
    margin-top: 16px;
    padding: 14px 16px;
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e0ecf5;
    font-size: 13px;
    color: #3a5a7a;
}

.wcp-wifi-instructions p {
    margin: 0 0 8px 0;
}

.wcp-wifi-instructions ol {
    margin: 0;
    padding-left: 20px;
}

.wcp-wifi-instructions li {
    margin-bottom: 4px;
    line-height: 1.5;
}

/* Bottone copia - label e stato copiato */
.wcp-copy-credential .wcp-copy-label {
    font-size: 11px;
    margin-left: 4px;
}

.wcp-copy-credential .wcp-copied-label {
    display: none;
    font-size: 11px;
    margin-left: 4px;
}

.wcp-copy-credential.wcp-copied .wcp-copy-label {
    display: none;
}

.wcp-copy-credential.wcp-copied .wcp-copied-label {
    display: inline;
}

.wcp-copy-credential {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    height: 36px;
    border: 1px solid #d0e3f7;
    border-radius: 8px;
    background: #f0f7ff;
    color: #3a7bd5;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0 10px;
    font-family: inherit;
    font-size: 13px;
}

/* Bottoni azione WiFi */
.wcp-wifi-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.wcp-wifi-connect-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #3a7bd5, #00d2ff);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
}

.wcp-wifi-connect-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(58, 123, 213, 0.35);
    color: #fff;
    text-decoration: none;
}

.wcp-wifi-settings-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #5a7a9a;
    background: #fff;
    border: 2px solid #d0e3f7;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.wcp-wifi-settings-btn:hover {
    background: #f0f7ff;
    border-color: #3a7bd5;
    color: #3a7bd5;
}

/* ============================================
   Compatibilità Elementor
   ============================================ */
.elementor-widget-container .wcp-portal-wrapper {
    min-height: auto;
}

.elementor-section .wcp-form-container {
    margin: 0 auto;
}
