/* ===========================
   QR DINAMICO - DESIGN SYSTEM
   Ispirato a: Bitly, Stripe, Linear
   NO AI-style, solo design professionale
   =========================== */

/* ===========================
   VARIABILI MODERNE
   =========================== */
:root {
    /* Palette Blu Scura - Professionale */
    --ink-black: #0d1b2a;
    --prussian-blue: #1b263b;
    --dusk-blue: #415a77;
    --dusty-denim: #778da9;
    
    --primary: #415a77;
    --primary-hover: #1b263b;
    --primary-light: #778da9;
    --accent: #778da9;
    --accent-hover: #415a77;
    
    /* Neutrali puliti */
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    
    /* Stati semantici */
    --success: #10B981;
    --success-light: #D1FAE5;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    
    /* Superfici */
    --bg-page: #0d1b2a;
    --bg-card: #1b263b;
    --border: #415a77;
    --text: #FFFFFF;
    --text-muted: #778da9;
    
    /* Shadows professionali */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
    
    /* Border radius */
    --radius: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    
    /* Spaziature */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
}

/* ===========================
   RESET E BASE
   =========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-page);
    color: var(--text);
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1.2;
}

h1 { font-size: 32px; }
h2 { font-size: 24px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.12s ease;
}

a:hover {
    color: var(--primary-hover);
}

/* ===========================
   CONTAINER
   =========================== */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: var(--space-lg);
}

/* ===========================
   AUTH PAGES - Stile Stripe
   =========================== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ink-black);
    padding: var(--space-lg);
}

.auth-box {
    background: var(--bg-card);
    padding: var(--space-2xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 400px;
}

.auth-box h2 {
    margin-bottom: var(--space-xs);
    color: var(--text);
    font-size: 24px;
}

.auth-box p {
    color: var(--text-muted);
    margin-bottom: var(--space-xl);
    font-size: 14px;
}

/* ===========================
   NAVIGATION - Stile Linear
   =========================== */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    background: rgba(27, 38, 59, 0.95);
}

.nav-container,
.navbar-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 56px;
}

.navbar-brand {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.navbar-menu {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
}

.navbar-menu a,
.nav-link {
    padding: 6px 12px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 13px;
    transition: all 0.12s ease;
}

.navbar-menu a:hover,
.nav-link:hover {
    background: var(--prussian-blue);
    color: var(--text);
}

.navbar-menu a.active,
.nav-link.active {
    background: var(--dusk-blue);
    color: var(--text);
}

/* ===========================
   FORM ELEMENTS
   =========================== */
.form-group {
    margin-bottom: var(--space-md);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-sm);
    color: var(--text);
    font-weight: 500;
    font-size: 13px;
    letter-spacing: -0.01em;
}

.form-group input,
.form-group select,
.form-group textarea,
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    transition: all 0.15s ease;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text);
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: var(--gray-300);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-group input::placeholder {
    color: var(--gray-400);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

/* ===========================
   BUTTONS - Sistema Bitly
   =========================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.12s ease;
    text-decoration: none;
    font-family: inherit;
    gap: var(--space-sm);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-xs);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-sm);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--prussian-blue);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--dusk-blue);
    border-color: var(--dusty-denim);
}

.btn-success {
    background: var(--success);
    color: white;
    box-shadow: var(--shadow-xs);
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger);
    color: white;
    box-shadow: var(--shadow-xs);
}

.btn-danger:hover {
    background: #DC2626;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: var(--prussian-blue);
    border-color: var(--dusty-denim);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    background: var(--prussian-blue);
    color: var(--text);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 12px 20px;
    font-size: 15px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ===========================
   CARDS
   =========================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border);
    transition: box-shadow 0.15s ease;
}

.card:hover {
    box-shadow: var(--shadow-sm);
}

.card-header {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.card-header p {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: var(--space-xs);
    line-height: 1.4;
}

.card-body {
    padding: 0;
}

.card-footer {
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

/* ===========================
   TABLES - Stripe Dashboard
   =========================== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-card);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--prussian-blue);
    border-bottom: 1px solid var(--border);
}

thead th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.12s ease;
}

tbody tr:hover {
    background: var(--prussian-blue);
}

tbody tr:last-child {
    border-bottom: none;
}

tbody td {
    padding: 14px 16px;
    color: var(--text);
    font-size: 14px;
    vertical-align: middle;
}

.action-btns {
    display: flex;
    gap: var(--space-sm);
}

/* ===========================
   BADGES
   =========================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-light);
    color: #D97706;
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-secondary {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* ===========================
   ALERTS
   =========================== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: start;
    gap: var(--space-sm);
    font-size: 13px;
    line-height: 1.5;
}

.alert-success {
    background: var(--success-light);
    border: 1px solid #A7F3D0;
    color: #065F46;
}

.alert-error,
.alert-danger {
    background: var(--danger-light);
    border: 1px solid #FECACA;
    color: #991B1B;
}

.alert-warning {
    background: var(--warning-light);
    border: 1px solid #FDE68A;
    color: #92400E;
}

.alert-info {
    background: var(--primary-light);
    border: 1px solid #BFDBFE;
    color: #1E40AF;
}

/* ===========================
   DASHBOARD STATS
   =========================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--bg-card);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    transition: all 0.15s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--gray-300);
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: var(--space-md);
}

.stat-card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-card-icon.primary {
    background: var(--primary-light);
    color: var(--primary);
}

.stat-card-icon.success {
    background: var(--success-light);
    color: var(--success);
}

.stat-card-icon.warning {
    background: var(--warning-light);
    color: #D97706;
}

.stat-card-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--space-xs);
    letter-spacing: -0.02em;
}

.stat-card-label {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

/* ===========================
   QR CODE PREVIEW
   =========================== */
.qr-preview {
    text-align: center;
    padding: var(--space-xl);
    background: var(--prussian-blue);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--border);
}

.qr-preview img {
    max-width: 300px;
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

/* ===========================
   MODAL
   =========================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-card);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    animation: modalSlide 0.2s ease;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    margin-bottom: var(--space-lg);
}

.modal-header h3 {
    font-size: 18px;
}

.modal-footer {
    margin-top: var(--space-xl);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

/* ===========================
   UTILITY CLASSES
   =========================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-1 { margin-top: var(--space-sm); }
.mt-2 { margin-top: var(--space-md); }
.mt-3 { margin-top: var(--space-lg); }
.mt-4 { margin-top: var(--space-xl); }

.mb-1 { margin-bottom: var(--space-sm); }
.mb-2 { margin-bottom: var(--space-md); }
.mb-3 { margin-bottom: var(--space-lg); }
.mb-4 { margin-bottom: var(--space-xl); }

.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.gap-1 { gap: var(--space-sm); }
.gap-2 { gap: var(--space-md); }
.gap-3 { gap: var(--space-lg); }

.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }

.font-mono { 
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 13px;
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 768px) {
    .container {
        padding: var(--space-md);
    }
    
    .auth-box {
        padding: var(--space-lg);
    }
    
    .nav-container,
    .navbar-content {
        padding: 0 var(--space-md);
    }
    
    .navbar-menu {
        flex-wrap: wrap;
        gap: var(--space-xs);
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }
    
    .card {
        padding: var(--space-md);
    }
    
    .table-container {
        font-size: 13px;
    }
    
    thead th {
        padding: 10px 12px;
        font-size: 11px;
    }
    
    tbody td {
        padding: 12px;
    }
    
    .btn {
        padding: 8px 14px;
        font-size: 13px;
    }
}

/* ===========================
   TOGGLE SWITCH CHECKBOX
   =========================== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-300);
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--success);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

