/* ============================================================
   Wellcum Membership System - CSS Principale
   ============================================================ */

:root {
    --primary: #1a1a1a;
    --secondary: #2d2d2d;
    --accent: #e6007e;
    --accent-light: #ff3399;
    --accent-dark: #c2006a;
    --violet-bg: #fef0f5;
    --success: #059669;
    --success-bg: #ecfdf5;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --info: #2563eb;
    --info-bg: #eff6ff;
    --text: #1a1a1a;
    --text-light: #6b7280;
    --text-muted: #9ca3af;
    --bg: #ffffff;
    --bg-alt: #f9fafb;
    --bg-dark: #f3f4f6;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.15);
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --transition: 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg-alt);
    -webkit-font-smoothing: antialiased;
}

/* ---- Layout ---- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---- Typography ---- */
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 22px; font-weight: 600; }
h3 { font-size: 18px; font-weight: 600; }
h4 { font-size: 16px; font-weight: 600; }

.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-lg { font-size: 20px; }
.text-xl { font-size: 24px; }
.text-2xl { font-size: 32px; }
.text-3xl { font-size: 40px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-light); }
.font-bold { font-weight: 700; }
.font-mono { font-family: 'JetBrains Mono', monospace; }

/* ---- Spacing ---- */
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.p-12 { padding: 12px; }
.p-16 { padding: 16px; }
.p-20 { padding: 20px; }
.p-24 { padding: 24px; }

/* ---- Cards ---- */
.card {
    background: var(--bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* ---- Forms ---- */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    font-size: 16px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(230, 0, 126, 0.15);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    height: auto;
    min-height: 100px;
    padding: 12px 16px;
    resize: vertical;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 48px;
    padding: 0 24px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    border: 2px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
}

.btn-dark {
    background: var(--primary);
    color: white;
}

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

.btn-outline {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

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

.btn-danger {
    background: var(--danger);
    color: white;
}

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

.btn-sm {
    height: 36px;
    padding: 0 16px;
    font-size: 13px;
}

.btn-lg {
    height: 56px;
    padding: 0 32px;
    font-size: 18px;
}

.btn-full {
    width: 100%;
}

.btn-icon {
    width: 48px;
    padding: 0;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---- Tables ---- */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg-dark);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
}

tr:hover {
    background: var(--bg-alt);
}

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-normal { background: #f3f4f6; color: #4b5563; }
.badge-bronze { background: linear-gradient(135deg, #92400e, #b45309); color: white; }
.badge-silver { background: linear-gradient(135deg, #6b7280, #9ca3af); color: white; }
.badge-gold   { background: linear-gradient(135deg, #92400e, #d69e2e); color: white; }

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info    { background: var(--info-bg);    color: var(--info); }

/* ---- Alerts / Flash Messages ---- */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.alert-success { background: var(--success-bg); color: var(--success); border-color: #a7f3d0; }
.alert-danger  { background: var(--danger-bg);  color: var(--danger);  border-color: #fecaca; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: #fde68a; }
.alert-info    { background: var(--info-bg);    color: var(--info);    border-color: #bfdbfe; }

/* ---- Toast Notification ---- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius);
    background: var(--primary);
    color: white;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    min-width: 280px;
}

.toast-success { background: var(--success); }
.toast-danger  { background: var(--danger); }
.toast-warning { background: var(--warning); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ---- Pagination ---- */
.pagination {
    display: flex;
    gap: 4px;
    margin-top: 20px;
    justify-content: center;
}

.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    color: var(--text);
    border: 1px solid var(--border);
}

.pagination a:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.pagination .active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* ---- Utilities ---- */
.hidden { display: none !important; }
.relative { position: relative; }
.overflow-hidden { overflow: hidden; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }
.rounded { border-radius: var(--radius); }
.border { border: 1px solid var(--border); }
.opacity-50 { opacity: 0.5; }

/* ---- Loading Spinner ---- */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.05); }
}

/* ---- Modal ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: white;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ---- Scrollbar personalizzata ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- Status Dots ---- */
.status-dots {
    display: flex;
    gap: 10px;
    align-items: center;
}

.status-dot {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-dot::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dc2626;
    flex-shrink: 0;
}

.status-dot.online::before {
    background: #059669;
    box-shadow: 0 0 4px rgba(5, 150, 105, 0.5);
}

.status-dot.offline::before {
    background: #dc2626;
}

/* ---- Language Flags ---- */
.lang-flags {
    display: flex;
    gap: 6px;
    align-items: center;
}

.lang-flags a {
    font-size: 20px;
    text-decoration: none;
    opacity: 0.5;
    transition: opacity 0.2s, transform 0.2s;
    line-height: 1;
}

.lang-flags a:hover {
    opacity: 0.8;
    transform: scale(1.15);
}

.lang-flags a.active {
    opacity: 1;
}

/* ---- Test Modal Tabs ---- */
.tab-nav {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}

.tab-nav button {
    flex: 1;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.2s;
}

.tab-nav button.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ---- Floating Test Panel (draggable) ---- */
.floating-panel {
    position: fixed;
    z-index: 9999;
    width: 480px;
    max-height: 85vh;
    background: var(--bg);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25), 0 2px 8px rgba(0,0,0,0.15);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.floating-panel.dragging {
    box-shadow: 0 12px 48px rgba(0,0,0,0.35), 0 4px 12px rgba(0,0,0,0.2);
}

.floating-panel.minimized .floating-panel-body {
    display: none;
}

.floating-panel.minimized {
    max-height: none;
    width: auto;
    min-width: 200px;
}

.floating-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--primary);
    color: white;
    font-size: 14px;
    font-weight: 700;
    cursor: move;
    user-select: none;
    -webkit-user-select: none;
    gap: 12px;
}

.floating-panel-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.floating-panel .tab-nav {
    margin-bottom: 12px;
}

.floating-panel .tab-nav button {
    padding: 8px 10px;
    font-size: 12px;
}

.floating-panel .alert {
    font-size: 12px;
    padding: 8px 12px;
}

.floating-panel .btn-sm {
    min-height: 32px;
    font-size: 13px;
}

/* ============================================================
   RESPONSIVE - Admin & Member (NOT operator - fixed 13" screen)
   ============================================================ */

/* ---- Tablet (max-width: 1024px) ---- */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .container { padding: 0 16px; }
}

/* ---- Mobile (max-width: 768px) ---- */
@media (max-width: 768px) {
    .grid-2,
    .grid-3,
    .grid-4 { grid-template-columns: 1fr; }

    .table-wrap { -webkit-overflow-scrolling: touch; }

    .form-input,
    .form-select,
    .form-textarea { min-height: 44px; }

    .btn-sm { min-height: 44px; }

    .modal {
        width: 95%;
        max-width: none;
        margin: 16px;
    }

    h1 { font-size: 22px; }
    h2 { font-size: 18px; }

    .gap-16 { gap: 8px; }
    .gap-20 { gap: 12px; }

    .card-header { padding: 12px 16px; font-size: 14px; }
    .card-body { padding: 16px; }

    th, td { padding: 10px 12px; font-size: 13px; }

    .pagination a,
    .pagination span { width: 36px; height: 36px; font-size: 13px; }
}

/* ---- Small mobile (max-width: 480px) ---- */
@media (max-width: 480px) {
    .container { padding: 0 8px; }
    html, body { font-size: 15px; }
    .p-20 { padding: 14px; }
    .p-24 { padding: 16px; }
}
