@import url('/static/css/theme.css');
@import url('/static/css/typography.css');

:root {
    --primary-dark: #198754;
    --primary-light: #e9f7ef;
    --secondary-color: #6c757d;
    --background: #f8f9fa;
    --surface: #ffffff;
    --surface-light: #f1f3f4;
    --text-primary: #222;
    --text-secondary: #6c757d;
    --accent: #4fd1c7;
    --success: #10b981;
    --success-color: #28a745;
    --success-dark: #1e7e34;
    --warning: #f59e0b;
    --error: #ef4444;
    --border: #e0e0e0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
}


/* Bottoni piccoli stile admin */
.btn-sm {
    display: inline-block;
    font-size: 0.85rem;
    padding: 4px 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    margin: 0 2px;
    transition: background 0.2s, color 0.2s;
    font-weight: 500;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
}

.btn-primary:hover {
    background: #7300cd;
}

.btn-success {
    background: var(--success-color);
    color: #fff;
}

.btn-success:hover {
    background: var(--success-dark);
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-warning:hover {
    background: #d97706;
}

/* Input piccoli */
.input-sm {
    font-size: 0.95rem;
    padding: 6px 10px;
    border-radius: 5px;
    border: 1px solid var(--border);
    margin-bottom: 8px;
    width: 90%;
    max-width: 320px;
    box-sizing: border-box;
}

/* Switch/Slider custom per toggle visibilità */
.switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 22px;
    vertical-align: middle;
}

.switch input {
    display: none;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 22px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 1px 3px #0002;
}

input:checked+.slider {
    background-color: var(--primary-color);
}

input:checked+.slider:before {
    transform: translateX(16px);
}

.slider.round {
    border-radius: 22px;
}

.slider.round:before {
    border-radius: 50%;
}

* {
    box-sizing: border-box;
}

a {
    text-decoration: none;
    color: white;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
    background: var(--background);
}

body.site-bg,
body.login-style-bg,
body:not(:has(.compact-header)) {
    background:
        radial-gradient(circle at -7% 10%, rgba(168, 85, 247, 0.7), transparent 22%),
        radial-gradient(circle at 98% 88%, rgba(236, 72, 153, 0.54), transparent 20%),
        radial-gradient(circle at 50% 50%, rgba(168, 85, 247, 0.44), transparent 18%),
        radial-gradient(circle at 89% 0%, rgba(124, 58, 237, 0.28), transparent 18%),
        linear-gradient(135deg, #060511 0%, #100628 45%, #070512 100%) !important;
    background-attachment: fixed !important;
    position: relative !important;
    isolation: isolate !important;
    overflow-x: hidden !important;
}

body.site-bg::before,
body.site-bg::after,
body.login-style-bg::before,
body.login-style-bg::after,
body:not(:has(.compact-header))::before,
body:not(:has(.compact-header))::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: float 15s infinite ease-in-out;
    pointer-events: none;
    z-index: 0;
}

body.site-bg::before,
body.login-style-bg::before,
body:not(:has(.compact-header))::before {
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

body.site-bg::after,
body.login-style-bg::after,
body:not(:has(.compact-header))::after {
    bottom: -150px;
    right: -150px;
    animation-delay: 7s;
}

body.site-bg > *,
body.login-style-bg > *,
body:not(:has(.compact-header)) > * {
    position: relative;
    z-index: 1;
}

body:has(.compact-header) {
    background: var(--background) !important;
    background-attachment: initial !important;
    isolation: auto !important;
}

body:has(.compact-header)::before,
body:has(.compact-header)::after {
    content: none !important;
    display: none !important;
}

body.login-style-bg .compact-header,
body.login-style-bg .impostazioni-header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.92), rgba(118, 75, 162, 0.92)) !important;
    box-shadow: 0 12px 30px rgba(118, 75, 162, 0.24) !important;
    backdrop-filter: blur(14px);
}

body.login-style-bg .package-info-bar {
    background: rgba(255, 255, 255, 0.16);
    border-bottom-color: rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(14px);
}

body.login-style-bg .package-name {
    color: #764ba2;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(50px, 50px) scale(1.1); }
}

/* Puntino custom per affiliato */
.affiliato-cursor #affiliato-dot-cursor {
    position: fixed;
    width: 18px;
    height: 18px;
    background: #764ba2;
    border-radius: 50%;
    box-shadow: 0 0 8px #764ba2aa;
    pointer-events: none;
    z-index: 99999;
    transform: translate(-50%, -50%);
    border: 2px solid #fff;
    transition: opacity 0.2s;
}

/* Nascondi il cursore classico per affiliato */
.affiliato-cursor {
    cursor: none !important;
}

/* Scrollbar ingrandita per affiliato */
.affiliato-cursor ::-webkit-scrollbar {
    width: 18px;
    background: #e0e0e0;
}
.affiliato-cursor ::-webkit-scrollbar-thumb {
    background: #764ba2;
    border-radius: 9px;
    border: 3px solid #fff;
}
.affiliato-cursor ::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 9px;
}

/* Package Info Bar - Common style across all pages */
.package-info-bar {
    background-color: #f0f8ff;
    padding: 8px 16px;
    border-bottom: 1px solid #ddd;
    width: 100%;
}

.package-info {
    display: flex;
    justify-content: space-between;
    max-width: 800px;
    margin: 0 auto;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.9rem;
}

.package-name {
    font-weight: bold;
    color: var(--primary-color);
}

.package-remaining,
.package-expiry {
    color: var(--text-secondary);
}

.top-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    padding-right: 16px;
    z-index: 1000;
    background-color: #48aed3;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info-item {
    display: flex;
    flex-direction: column;
}

.user-info-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
}

.user-info-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
}

.user-info-token {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.info-token-type {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
}

.info-token-balance {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fbbf24;
    text-align: center;
    transition: all 0.3s ease;
}

.info-token-balance:hover {
    transform: scale(1.05);
}

.result-message {
    text-align: center;
    margin: 12px 0;
    font-weight: 600;
    color: var(--primary-dark);
    padding: 8px 12px;
    border-radius: 6px;
    background: var(--surface-light);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.result-message.error {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--error);
}

.result-message.success {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
}

.result-message.warning {
    color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--warning);
}

.logo {
    height: 200px;
}

.logo img {
    display: flex;
    align-items: center;
    height: 100%;
}

.vertical-divider {
    width: 1px;
    height: 30px;
    background-color: white;
    opacity: 0.5;
}

.logout-link {
    color: white;
    text-align: center;
    font-size: smaller;
}

.logout-link a {
    color: white;
    text-decoration: none;
}

.logout-link a:hover {
    font-weight: bold;
}


/*--------------------------------------------------*/
.center_text,
.text-center,
.centre-text,
.center-text,
.text-center {
    text-align: center;
}

/* =============================================== */
/* 🔔 NOTIFICHE / NOTIFICATIONS */
/* =============================================== */

.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    z-index: 9999;
    opacity: 0;
    transform: translateX(120%);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border-left: 4px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    max-width: 320px;
    word-wrap: break-word;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification.hide {
    opacity: 0;
    transform: translateX(120%);
}

.notification.info {
    background: linear-gradient(135deg, var(--primary-color), #3b82f6);
    border-left-color: #60a5fa;
}

.notification.success {
    background: linear-gradient(135deg, var(--success), #059669);
    border-left-color: #34d399;
}

.notification.error {
    background: linear-gradient(135deg, var(--error), #dc2626);
    border-left-color: #f87171;
}

.notification.warning {
    background: linear-gradient(135deg, var(--warning), #d97706);
    border-left-color: #fbbf24;
}

.notification::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: inherit;
    border-radius: inherit;
    opacity: 0.8;
    z-index: -1;
}

.notification:hover {
    transform: translateX(-5px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
}

/* Responsive per schermi piccoli */
@media (max-width: 768px) {
    .notification {
        top: 70px;
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100%);
    }

    .notification.show {
        transform: translateY(0);
    }

    .notification.hide {
        transform: translateY(-100%);
    }

    .notification:hover {
        transform: translateY(-2px) scale(1.01);
    }
}

/* =============================================== */
/* POPUP / MODALI - Tema SnapLink dark glass */
/* =============================================== */
:root {
    --popup-bg: #0f0f1a;
    --popup-card: rgba(255, 255, 255, 0.075);
    --popup-card-strong: rgba(255, 255, 255, 0.11);
    --popup-border: rgba(255, 255, 255, 0.14);
    --popup-text: #f8f7ff;
    --popup-muted: #c9c2e8;
    --popup-purple: #7c3aed;
    --popup-purple-soft: #a855f7;
    --popup-pink: #ec4899;
}

body.swal2-shown,
body.swal2-height-auto {
    height: auto !important;
    overflow: hidden !important;
    padding-right: 0 !important;
}

.swal2-container {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 16px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    z-index: 2147483000 !important;
}

.swal2-container.swal2-backdrop-show,
.swal2-container.swal2-noanimation {
    background:
        radial-gradient(circle at 18% 18%, rgba(124, 58, 237, 0.28), transparent 34%),
        radial-gradient(circle at 86% 78%, rgba(236, 72, 153, 0.16), transparent 28%),
        rgba(4, 3, 13, 0.78) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
}

.swal2-popup {
    margin: auto !important;
    width: min(92vw, 430px) !important;
    max-width: 430px !important;
    border-radius: 24px !important;
    padding: 30px 28px 26px !important;
    color: var(--popup-text) !important;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.045)) !important;
    border: 1px solid var(--popup-border) !important;
    box-shadow:
        0 26px 80px rgba(0, 0, 0, 0.52),
        0 0 28px rgba(168, 85, 247, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    transform: none !important;
}

.swal2-title {
    color: var(--popup-text) !important;
    font-size: clamp(1.28rem, 4vw, 1.58rem) !important;
    font-weight: 800 !important;
    letter-spacing: 0 !important;
    padding: 0 !important;
}

.swal2-html-container,
.swal2-content,
.swal2-footer {
    color: var(--popup-muted) !important;
    font-size: 0.96rem !important;
    line-height: 1.55 !important;
}

.swal2-icon {
    width: 66px !important;
    height: 66px !important;
    margin: 2px auto 18px !important;
    border-width: 2px !important;
    box-shadow: 0 0 24px rgba(168, 85, 247, 0.24) !important;
}

.swal2-icon.swal2-question,
.swal2-icon.swal2-info {
    border-color: rgba(168, 85, 247, 0.66) !important;
    color: #d8b4fe !important;
}

.swal2-icon.swal2-warning {
    border-color: rgba(168, 85, 247, 0.66) !important;
    color: #d8b4fe !important;
}

.swal2-icon.swal2-success {
    border-color: rgba(34, 197, 94, 0.58) !important;
    color: #86efac !important;
}

.swal2-icon.swal2-error {
    border-color: rgba(248, 113, 113, 0.58) !important;
    color: #fca5a5 !important;
}

.swal2-actions {
    width: 100% !important;
    gap: 10px !important;
    margin: 24px auto 0 !important;
}

.swal2-styled {
    min-height: 44px !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 12px !important;
    padding: 11px 20px !important;
    font-weight: 800 !important;
    box-shadow: none !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease !important;
}

.swal2-styled:focus {
    box-shadow:
        0 0 0 4px rgba(168, 85, 247, 0.16),
        0 0 24px rgba(168, 85, 247, 0.2) !important;
}

.swal2-confirm {
    background: linear-gradient(135deg, var(--popup-purple-soft), var(--popup-purple)) !important;
    color: #ffffff !important;
}

.swal2-cancel,
.swal2-deny {
    background: rgba(255, 255, 255, 0.08) !important;
    color: var(--popup-text) !important;
}

.swal2-styled:hover {
    transform: translateY(-2px) !important;
    filter: brightness(1.08) !important;
    box-shadow:
        0 14px 30px rgba(124, 58, 237, 0.26),
        0 0 24px rgba(168, 85, 247, 0.18) !important;
}

.swal2-loader {
    border-color: var(--popup-purple-soft) transparent var(--popup-purple-soft) transparent !important;
}

.swal2-input,
.swal2-textarea,
.swal2-select,
.swal2-file {
    color: var(--popup-text) !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 12px !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

.swal2-input:focus,
.swal2-textarea:focus,
.swal2-select:focus {
    border-color: rgba(168, 85, 247, 0.82) !important;
    box-shadow:
        0 0 0 4px rgba(168, 85, 247, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

.swal2-close {
    color: rgba(248, 247, 255, 0.72) !important;
}

.swal2-close:hover {
    color: #ffffff !important;
}

.modal-overlay,
.packages-modal,
.camera-modal,
.processing-modal,
.result-modal,
.print-modal,
.download-qr-modal,
.email-modal,
.zoom-modal,
.sharing-modal {
    background:
        radial-gradient(circle at 18% 18%, rgba(124, 58, 237, 0.24), transparent 34%),
        rgba(4, 3, 13, 0.78) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.modal-overlay.open,
.modal-overlay.active,
.packages-modal.active,
.camera-modal.active,
.processing-modal.active,
.result-modal.active,
.print-modal.active,
.download-qr-modal.active,
.email-modal.active,
.zoom-modal.active,
.sharing-modal.active {
    align-items: center !important;
    justify-content: center !important;
}

.modal-box,
.modal-content,
.print-modal-content,
.download-qr-modal-content,
.email-modal-content,
.sharing-modal-content {
    color: var(--popup-text) !important;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.045)) !important;
    border: 1px solid var(--popup-border) !important;
    border-radius: 22px !important;
    box-shadow:
        0 26px 80px rgba(0, 0, 0, 0.52),
        0 0 28px rgba(168, 85, 247, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

.modal-title,
.print-modal-title,
.email-modal-header h2,
.download-qr-modal-content h2,
.modal-box h1,
.modal-box h2,
.modal-content h1,
.modal-content h2 {
    color: var(--popup-text) !important;
}

.modal-box p,
.modal-content p,
.email-modal-body,
.download-qr-modal-content p {
    color: var(--popup-muted) !important;
}

.modal-close,
.email-modal-close {
    color: rgba(248, 247, 255, 0.72) !important;
}

.modal-close:hover,
.email-modal-close:hover {
    color: #ffffff !important;
}

@media (max-width: 640px) {
    .swal2-container {
        padding: 14px !important;
    }

    .swal2-popup {
        width: min(94vw, 430px) !important;
        padding: 26px 20px 22px !important;
        border-radius: 20px !important;
    }

    .swal2-actions {
        flex-direction: column !important;
    }

    .swal2-styled {
        width: 100% !important;
        margin: 0 !important;
    }
}
