/* ===== Hi5 WhatsApp Platform - Design System ===== */
:root {
    --primary: #25D366;
    --primary-dark: #128C7E;
    --primary-light: #DCF8C6;
    --accent: #075E54;
    --bg-dark: #0a0f1a;
    --bg-card: #111827;
    --bg-card-hover: #1a2332;
    --bg-sidebar: #0d1321;
    --bg-input: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #1e293b;
    --border-light: #334155;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    --gradient-primary: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    --gradient-dark: linear-gradient(135deg, #0a0f1a 0%, #1a1a2e 100%);
    --gradient-card: linear-gradient(145deg, #111827 0%, #0d1321 100%);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 14px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 20px rgba(37,211,102,0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }

/* ===== Sidebar ===== */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: var(--transition);
}

.sidebar.collapsed { width: 70px; }
.sidebar.collapsed .sidebar-header span,
.sidebar.collapsed .sidebar-nav span,
.sidebar.collapsed .user-info span,
.sidebar.collapsed .nav-separator span { display: none; }
.sidebar.collapsed .sidebar-nav a { justify-content: center; }
.sidebar.collapsed .sidebar-footer { flex-direction: column; align-items: center; gap: 8px; }

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
}

.logo i { font-size: 1.8rem; }

.sidebar-nav {
    list-style: none;
    padding: 12px;
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-nav li a:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.sidebar-nav li a.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-glow);
}

.sidebar-nav li a i { width: 20px; text-align: center; font-size: 1rem; }

.nav-separator {
    padding: 16px 16px 8px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    font-weight: 600;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    overflow: hidden;
}

.user-info i { font-size: 1.4rem; color: var(--primary); }

.btn-logout {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-logout:hover { color: var(--error); background: rgba(239,68,68,0.1); }

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    transition: var(--transition);
}

.sidebar.collapsed ~ .main-content { margin-left: 70px; }

.top-bar {
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    backdrop-filter: blur(10px);
    background: rgba(10,15,26,0.8);
    position: sticky;
    top: 0;
    z-index: 50;
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.menu-toggle:hover { background: var(--bg-card); color: var(--text-primary); }

.page-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.content-area { padding: 32px; }

/* ===== Auth Layout ===== */
.auth-layout {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-dark);
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 480px;
    background: var(--gradient-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.5s ease;
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo i { font-size: 3rem; color: var(--primary); }
.auth-logo h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-top: 12px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-logo p { color: var(--text-secondary); margin-top: 8px; font-size: 0.9rem; }

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,211,102,0.15);
}

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

textarea.form-control { min-height: 120px; resize: vertical; }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(37,211,102,0.25);
    color: white;
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
    color: var(--text-primary);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.btn-danger:hover { transform: translateY(-2px); }

.btn-sm { padding: 8px 16px; font-size: 0.8rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }
.btn-block { width: 100%; }

/* ===== Cards ===== */
.card {
    background: var(--gradient-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-md);
}

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

.card-header h3 { font-size: 1.1rem; font-weight: 700; }

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--gradient-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.stat-icon.green { background: rgba(37,211,102,0.15); color: var(--primary); }
.stat-icon.blue { background: rgba(59,130,246,0.15); color: var(--info); }
.stat-icon.amber { background: rgba(245,158,11,0.15); color: var(--warning); }
.stat-icon.red { background: rgba(239,68,68,0.15); color: var(--error); }

.stat-info h4 { font-size: 1.8rem; font-weight: 800; }
.stat-info p { font-size: 0.8rem; color: var(--text-secondary); margin-top: 4px; }

/* ===== Tables ===== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

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

th {
    padding: 14px 16px;
    text-align: left;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-card);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 14px 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

tr:hover td { background: var(--bg-card-hover); }
tr:last-child td { border-bottom: none; }

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-error { background: rgba(239,68,68,0.15); color: var(--error); }
.badge-info { background: rgba(59,130,246,0.15); color: var(--info); }

/* ===== Alerts ===== */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin: 0 32px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    animation: fadeInDown 0.3s ease;
}

.alert-success {
    background: rgba(34,197,94,0.1);
    border: 1px solid rgba(34,197,94,0.3);
    color: var(--success);
}

.alert-error {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    color: var(--error);
}

/* ===== Plan Cards ===== */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.plan-card {
    background: var(--gradient-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 32px;
    text-align: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.plan-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: var(--transition);
}

.plan-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

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

.plan-card.featured {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.plan-card.featured::before { opacity: 1; }

.plan-name { font-size: 1.3rem; font-weight: 700; margin-bottom: 8px; }

.plan-price {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 16px 0;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.plan-price span { font-size: 1rem; font-weight: 500; }

.plan-features {
    list-style: none;
    margin: 24px 0;
    text-align: left;
}

.plan-features li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.plan-features li i { color: var(--primary); }
.plan-features li:last-child { border-bottom: none; }

/* ===== QR Viewer ===== */
.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 40px;
}

.qr-image {
    width: 280px;
    height: 280px;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    overflow: hidden;
}

.qr-image img { width: 100%; height: 100%; object-fit: contain; }

.qr-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

.qr-status .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.dot.pending { background: var(--warning); }
.dot.active { background: var(--success); animation: none; }
.dot.disconnected { background: var(--error); animation: none; }

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 1.2rem; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 0.9rem; margin-bottom: 24px; }

/* ===== Grid Layouts ===== */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }

/* ===== Animations ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

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

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar { width: 70px; }
    .sidebar .sidebar-header span,
    .sidebar .sidebar-nav span,
    .sidebar .user-info span,
    .sidebar .nav-separator span { display: none; }
    .sidebar .sidebar-nav a { justify-content: center; }
    .sidebar .sidebar-footer { flex-direction: column; align-items: center; gap: 8px; }
    .main-content { margin-left: 70px; }
    .content-area { padding: 20px; }
    .stats-grid { grid-template-columns: 1fr; }
    .plans-grid { grid-template-columns: 1fr; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .auth-card { padding: 32px 24px; }
}
