:root {
    /* Palette Premium */
    --primary: #00d285;
    --primary-dark: #00a86b;
    --primary-glow: rgba(0, 210, 133, 0.3);
    --secondary: #34b7f1;
    
    /* Backgrounds */
    --bg-main: #080c10;
    --bg-card: #12181f;
    --bg-sidebar: #0e1217;
    --bg-input: #1a222c;
    
    /* Text */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    /* Decoration */
    --border: rgba(255, 255, 255, 0.06);
    --glass: rgba(255, 255, 255, 0.03);
    --glass-hover: rgba(255, 255, 255, 0.06);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
}

#app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar Styling - Premium Look */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

.sidebar-header {
    padding: 40px 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.logo-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 10px var(--primary-glow));
}

.logo-text {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.plan-info {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 10px;
}

.plan-badge {
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    color: white;
    font-size: 10px;
    font-weight: 900;
    padding: 3px 10px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.plan-usage {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
    display: block;
}

.sidebar-nav {
    flex: 1;
    padding: 10px 16px;
    overflow-y: auto;
}

.nav-item {
    width: 100%;
    background: transparent;
    border: none;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 6px;
    text-align: left;
}

.nav-item:hover {
    background: var(--glass-hover);
    color: var(--text-main);
    transform: translateX(4px);
}

.nav-item.active {
    background: rgba(0, 210, 133, 0.1);
    color: var(--primary);
    box-shadow: inset 0 0 0 1px rgba(0, 210, 133, 0.15);
}

.nav-icon {
    font-size: 20px;
    transition: transform 0.3s;
}

.nav-item:hover .nav-icon {
    transform: scale(1.1);
}

.sidebar-footer {
    padding: 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.2);
}

.btn-logout {
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--text-dim);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(255, 75, 75, 0.15);
    color: #ff4b4b;
    border-color: rgba(255, 75, 75, 0.3);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff4b4b;
    position: relative;
}

.status-indicator.connected .status-dot {
    background: var(--primary);
    box-shadow: 0 0 12px var(--primary);
}

.status-indicator.connected .status-dot::after {
    content: '';
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    border: 2px solid var(--primary);
    border-radius: 50%;
    animation: ripple 1.5s infinite;
}

@keyframes ripple {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(2); opacity: 0; }
}

/* Main Content Styling */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: radial-gradient(circle at 100% 0%, #111a21 0%, #080c10 50%);
}

.view-container .view {
    display: none !important;
    padding: 40px;
    animation: slideUpFade 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.view-container .view.active {
    display: block !important;
}

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.top-bar {
    padding: 24px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(20px);
    background: rgba(8, 12, 16, 0.7);
    position: sticky;
    top: 0;
    z-index: 10;
}

h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.view-container {
    padding: 40px;
    flex: 1;
}

/* QR Loader Premium */
.qr-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.qr-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(0, 210, 133, 0.1);
    border-left-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
    box-shadow: 0 0 20px rgba(0, 210, 133, 0.2);
}

.qr-loading-text {
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
    font-weight: 600;
    font-size: 18px;
    animation: pulse 1.5s infinite;
}

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

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

/* Stats Cards - Premium Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(0, 210, 133, 0.2);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 4px; height: 100%;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    font-size: 28px;
    background: var(--glass);
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--primary);
    box-shadow: inset 0 0 0 1px var(--border);
}

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

.stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 32px;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
}

/* Content Cards */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.card-header h2 {
    font-size: 20px;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.3px;
}

/* QR Code Section - Polished */
.qr-container {
    background: white;
    padding: 20px;
    border-radius: var(--radius-md);
    width: 240px;
    height: 240px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.qr-instruction {
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 250px;
    margin: 0 auto;
}

/* Forms - Modern Inputs */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
}

input, select, textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 15px;
    transition: all 0.2s;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: #1e293b;
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px var(--primary-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--primary-glow);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Groups List - Grid Layout */
.groups-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.group-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: var(--shadow-sm);
}

.group-item:hover {
    border-color: var(--primary);
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.group-card-top {
    display: flex;
    align-items: center;
    gap: 16px;
}

.group-avatar {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: white;
    font-size: 22px;
    box-shadow: 0 4px 10px var(--primary-glow);
}

.group-title-area {
    flex: 1;
}

.group-title-area h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-main);
}

.group-id-text {
    font-size: 11px;
    color: var(--text-dim);
    font-family: 'Inter', monospace;
}

.category-badge {
    background: rgba(52, 183, 241, 0.1);
    color: var(--secondary);
    font-size: 10px;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 0.5px;
    border: 1px solid rgba(52, 183, 241, 0.2);
}

.group-actions-row {
    display: flex;
    gap: 12px;
    margin-top: auto;
}

.btn-group-action {
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-group-action:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 10px var(--primary-glow);
}

.btn-group-action[title="Catégorie"] {
    flex: 0 0 44px;
    font-size: 16px;
}

/* Status Badges - Refined */
.status-badge {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-pending { background: rgba(255, 165, 0, 0.1); color: #ff9f43; border: 1px solid rgba(255, 165, 0, 0.2); }
.status-sent { background: rgba(0, 210, 133, 0.1); color: var(--primary); border: 1px solid rgba(0, 210, 133, 0.2); }
.status-failed { background: rgba(255, 75, 75, 0.1); color: #ff4b4b; border: 1px solid rgba(255, 75, 75, 0.2); }

/* Table Styling */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
}

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

.tasks-table th {
    text-align: left;
    padding: 20px;
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--border);
}

.tasks-table td {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-main);
}

.tasks-table tr:hover {
    background: var(--glass);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--bg-sidebar);
    border-left: 4px solid var(--primary);
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    transform: translateY(100px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}

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

.task-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.task-mini-card {
    background: var(--glass);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border);
}

.tmc-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tmc-info strong {
    font-size: 14px;
}

.tmc-info span {
    font-size: 11px;
    color: var(--text-muted);
}

.status-dot-mini {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-pending { background-color: orange; }
.status-sent { background-color: var(--primary); }
.status-failed { background-color: #ff4b4b; }

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.search-bar input {
    max-width: 400px;
}

@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
    .sidebar {
        width: 80px;
    }
    .nav-label, .logo-text, .status-text {
        display: none;
    }
    .sidebar-header {
        padding: 20px 10px;
        text-align: center;
    }
}

/* Modal System - Premium Glassmorphism */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(4, 6, 8, 0.85);
    backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from { transform: translateY(40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-body {
    padding: 30px;
}

.btn-close {
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-close:hover {
    background: rgba(255, 75, 75, 0.1);
    color: #ff4b4b;
}

/* Toast Notification - Elegant */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    padding: 16px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(120%);
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 2000;
}

.toast.show {
    transform: translateX(0);
}

.toast::before {
    content: "✨";
    font-size: 18px;
}

/* Pricing - Polished */
.pricing-modal-card {
    max-width: 900px !important;
}

.pricing-grid-modal {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    padding: 24px 0;
}

.price-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    text-align: center;
    transition: all 0.3s;
}

.price-item.popular {
    background: rgba(0, 210, 133, 0.03);
    border-color: var(--primary);
    transform: scale(1.05);
    position: relative;
}

.pop-tag {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    font-size: 10px;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 20px;
    text-transform: uppercase;
}

.price-item h3 {
    font-size: 14px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.price-val {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 20px;
}

.price-item ul {
    list-style: none;
    margin-bottom: 30px;
}

.price-item li {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.price-item li::before {
    content: "✓";
    color: var(--primary);
    font-weight: bold;
}

.pricing-toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
}
.toggle-label { font-size: 14px; font-weight: 600; }
.discount-badge {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
}
.price-sub { font-size: 12px; color: var(--text-muted); margin-top: -10px; margin-bottom: 15px; }

/* Switch Toggle CSS */
.switch { position: relative; display: inline-block; width: 50px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--bg-sidebar); transition: .4s; border-radius: 34px;
    border: 1px solid var(--border);
}
.slider:before {
    position: absolute; content: ""; height: 18px; width: 18px; left: 4px; bottom: 3px;
    background-color: white; transition: .4s; border-radius: 50%;
}
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(24px); }

.plan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.btn-sync {
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--primary);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.btn-sync:hover {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.plan-limits-card {
    background: rgba(0, 210, 133, 0.05) !important;
    border-color: rgba(0, 210, 133, 0.1) !important;
    padding: 16px 24px !important;
    margin-bottom: 30px;
}

.limits-info {
    display: flex;
    gap: 32px;
    align-items: center;
    flex-wrap: wrap;
}

.limit-item {
    font-size: 14px;
    color: var(--text-dim);
    font-weight: 500;
}

.limit-item strong {
    color: var(--text-main);
}

.admin-notice {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon {
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--glass-hover);
    border-color: var(--text-muted);
}
.pop-tag {
    position: absolute;
    top: -10px; left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    font-size: 10px;
    padding: 2px 10px;
    border-radius: 100px;
    font-weight: 700;
}
