:root {
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-card: #1f2937;
    --bg-input: #111827;
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-soft: rgba(59,130,246,0.12);
    --success: #22c55e;
    --success-soft: rgba(34,197,94,0.12);
    --warning: #f59e0b;
    --warning-soft: rgba(245,158,11,0.12);
    --danger: #ef4444;
    --danger-soft: rgba(239,68,68,0.12);
    --border: rgba(255,255,255,0.06);
    --border-hover: rgba(255,255,255,0.12);
    --sidebar-width: 240px;
    --topbar-height: 56px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.5);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-hover); }

/* AUTH */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg-primary);
}
.auth-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.auth-header { text-align: center; margin-bottom: 32px; }
.auth-header i { font-size: 44px; color: var(--accent); margin-bottom: 12px; }
.auth-header h1 { font-size: 22px; font-weight: 600; margin-bottom: 6px; }
.auth-header p { color: var(--text-secondary); font-size: 14px; }
.auth-divider { text-align: center; margin: 20px 0; position: relative; color: var(--text-muted); font-size: 13px; }
.auth-divider::before { content: ''; position: absolute; left: 0; top: 50%; width: 100%; height: 1px; background: var(--border); }
.auth-divider span { background: var(--bg-secondary); padding: 0 14px; position: relative; }
.auth-footer { text-align: center; margin-top: 20px; color: var(--text-secondary); font-size: 14px; }

/* SIDEBAR */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
}
.sidebar-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    min-height: 56px;
}
.sidebar-header i { color: var(--accent); font-size: 20px; }
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    font-size: 14px;
    margin: 2px 8px;
    border-radius: var(--radius-sm);
}
.nav-link:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }
.nav-link.active {
    color: #fff;
    background: var(--accent);
    font-weight: 500;
}
.nav-link i { width: 20px; text-align: center; font-size: 15px; }
.nav-divider { height: 1px; background: var(--border); margin: 8px 16px; }
.nav-section { padding: 10px 16px 4px; font-size: 11px; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.5px; font-weight: 600; }
.sidebar-footer { border-top: 1px solid var(--border); padding: 12px 16px; }
.user-info { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* MAIN */
.main-content { margin-left: var(--sidebar-width); min-height: 100vh; }
.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.balance-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--success-soft);
    border-radius: 20px;
    color: var(--success);
    font-weight: 600;
    font-size: 14px;
}
.menu-toggle { display: none; background: none; border: none; color: var(--text-primary); font-size: 20px; cursor: pointer; padding: 4px; }
.page-content { padding: 24px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 22px; font-weight: 600; }

/* CARDS */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h3 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 20px; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stats-grid-lg { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.stat-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.stat-value { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* DASHBOARD GRID */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }

/* FORMS */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 14px; color: var(--text-secondary); font-weight: 500; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], textarea, select, .form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--text-muted); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.4;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #16a34a; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-secondary { background: rgba(255,255,255,0.06); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: rgba(255,255,255,0.1); }
.btn-google { background: #db4437; color: #fff; }
.btn-block { display: flex; width: 100%; justify-content: center; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* BADGES */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    transition: background-color 0.3s ease, color 0.3s ease;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-info { background: var(--accent-soft); color: var(--accent); }
.badge-secondary { background: rgba(156,163,175,0.12); color: var(--text-secondary); }

/* ALERTS */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; }
.alert-success { background: var(--success-soft); border: 1px solid rgba(34,197,94,0.2); color: var(--success); }
.alert-danger { background: var(--danger-soft); border: 1px solid rgba(239,68,68,0.2); color: var(--danger); }
.alert-warning { background: var(--warning-soft); border: 1px solid rgba(245,158,11,0.2); color: var(--warning); }

/* TABLE */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.3px;
}
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.table tbody tr:hover { background: rgba(255,255,255,0.02); }

/* PROXY CARDS */
.proxy-list { display: grid; gap: 16px; }
.proxy-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: opacity 0.3s ease, border-color 0.3s ease;
}
.proxy-card:hover { border-color: var(--border-hover); }
.proxy-card.disabled { opacity: 0.5; }
.proxy-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: rgba(0,0,0,0.15);
}
.proxy-status { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-dot.online { background: var(--success); box-shadow: 0 0 8px rgba(34,197,94,0.5); }
.status-dot.offline { background: var(--text-muted); }
.proxy-actions { display: flex; gap: 6px; }
.proxy-body { padding: 16px 20px; }
.proxy-info { display: grid; gap: 8px; font-size: 14px; }
.proxy-info code {
    background: rgba(0,0,0,0.3);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'SF Mono', 'Fira Code', monospace;
}
.live-traffic { transition: opacity 0.2s ease; }

/* TARIFFS */
.tariff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.tariff-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.tariff-card:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tariff-card.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.tariff-card h4 { margin-bottom: 8px; font-weight: 600; }
.tariff-features { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.tariff-features span { font-size: 12px; color: var(--text-secondary); }
.tariff-prices { margin-top: 12px; }
.price-item { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.price-item strong { color: var(--success); }

/* DURATIONS */
.duration-options { display: flex; flex-wrap: wrap; gap: 12px; }
.duration-btn {
    flex: 1;
    min-width: 120px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    font-family: inherit;
    font-size: 14px;
}
.duration-btn:hover { border-color: var(--accent); }
.duration-btn.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.duration-btn strong { display: block; margin-top: 8px; color: var(--success); font-size: 16px; }

/* ORDER SUMMARY */
.order-summary { margin-bottom: 16px; }
.summary-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.summary-row.total { font-weight: 700; font-size: 18px; border-bottom: none; color: var(--accent); }

/* TRAFFIC */
.traffic-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.traffic-stat { text-align: center; }
.traffic-label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.traffic-value { font-size: 20px; font-weight: 700; color: var(--accent); transition: opacity 0.3s ease; }

/* TRANSACTIONS */
.transaction-list { display: grid; gap: 8px; }
.transaction-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.transaction-item:last-child { border-bottom: none; }

/* NOTIFICATIONS */
.notification-list { display: grid; gap: 8px; }
.notification-item { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: rgba(0,0,0,0.15); }
.notification-item.unread { background: var(--accent-soft); border-left: 3px solid var(--accent); }
.notification-icon { font-size: 18px; margin-top: 2px; flex-shrink: 0; }
.notification-success .notification-icon { color: var(--success); }
.notification-warning .notification-icon { color: var(--warning); }
.notification-danger .notification-icon { color: var(--danger); }
.notification-info .notification-icon { color: var(--accent); }
.notification-body strong { display: block; margin-bottom: 4px; font-size: 14px; }
.notification-body p { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }

/* TICKETS */
.ticket-list { display: grid; gap: 8px; }
.ticket-item {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    transition: all 0.2s ease;
    color: var(--text-primary);
}
.ticket-item:hover { border-color: var(--accent); color: var(--text-primary); }
.ticket-item.ticket-new { border-left: 3px solid var(--success); }
.ticket-title { margin-bottom: 6px; font-weight: 500; }
.ticket-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ticket-preview { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }

/* CHAT */
.chat-container {
    max-height: 500px;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
}
.chat-container::-webkit-scrollbar { width: 6px; }
.chat-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.chat-message { display: flex; gap: 12px; margin-bottom: 16px; }
.chat-message.own { flex-direction: row-reverse; }
.chat-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    flex-shrink: 0;
    font-size: 14px;
}
.chat-message.staff .chat-avatar { background: var(--accent-soft); }
.chat-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(255,255,255,0.06);
    font-size: 14px;
}
.chat-message.own .chat-bubble { background: var(--accent-soft); }
.chat-author { font-size: 12px; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--text-secondary); }
.chat-text { font-size: 14px; line-height: 1.5; }
.chat-input-container { position: sticky; bottom: 0; }
.chat-input-form { display: flex; gap: 8px; align-items: flex-end; }
.chat-input-form textarea { flex: 1; resize: none; }

/* MODAL */
.modal { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); z-index: 1000; align-items: center; justify-content: center; padding: 20px; }
.modal.open { display: flex; }
.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal-sm { max-width: 400px; }
.modal-lg { max-width: 800px; }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}
.modal-body { padding: 20px; }
.btn-close { background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; padding: 4px; transition: color 0.2s; }
.btn-close:hover { color: var(--text-primary); }

/* INFO ITEMS */
.info-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.info-item:last-child { border-bottom: none; }
.info-item label { color: var(--text-secondary); }
.list-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: none; }

/* TEXT */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-danger { color: var(--danger); }

/* PAGINATION */
.pagination { display: flex; gap: 4px; margin-top: 16px; justify-content: center; flex-wrap: wrap; }

/* NOTIFICATIONS DROPDOWN */
.notifications-dropdown { position: relative; }
.notif-btn { background: none; border: none; color: var(--text-secondary); font-size: 18px; cursor: pointer; position: relative; padding: 6px; border-radius: 8px; transition: background 0.2s; }
.notif-btn:hover { background: rgba(255,255,255,0.06); }
.notif-btn .badge { position: absolute; top: -2px; right: -2px; font-size: 10px; transition: opacity 0.3s ease; }
.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 360px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    max-height: 400px;
    overflow-y: auto;
}
.notifications-dropdown:hover .dropdown-menu,
.dropdown-menu.show { display: block; }
.dropdown-header { padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 14px; }

/* RESPONSIVE */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: block; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .traffic-stats { grid-template-columns: 1fr; }
    .tariff-grid { grid-template-columns: 1fr; }
    .chat-bubble { max-width: 85%; }
    .page-content { padding: 16px; }
    .duration-options { flex-direction: column; }
}
