/* Xray Panel Styles - Modern & Responsive */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --dark-color: #1e293b;
    --light-color: #f1f5f9;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #334155;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --radius-sm: 8px;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    direction: rtl;
    -webkit-font-smoothing: antialiased;
}

/* ================= LOGIN PAGE ================= */
.login-wrapper {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.login-background .shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.6;
    animation: float 20s infinite ease-in-out;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: #ff6b9d;
    top: -100px;
    right: -100px;
    animation-delay: 0s;
}

.shape-2 {
    width: 300px;
    height: 300px;
    background: #4facfe;
    bottom: -50px;
    left: -50px;
    animation-delay: -7s;
}

.shape-3 {
    width: 250px;
    height: 250px;
    background: #43e97b;
    top: 40%;
    left: 30%;
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 40px 35px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.login-logo {
    text-align: center;
    margin-bottom: 25px;
}

.logo-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 36px;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: var(--dark-color);
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 15px;
}

.login-form .input-group {
    margin-bottom: 22px;
}

.login-form .input-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--dark-color);
    font-weight: 600;
    font-size: 14px;
}

.login-form .input-group label i {
    color: var(--primary-color);
    font-size: 14px;
}

.input-wrapper {
    position: relative;
}

.input-wrapper input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 15px;
    transition: all 0.3s;
    background: white;
    direction: rtl;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.input-wrapper input::placeholder {
    color: #94a3b8;
    font-size: 14px;
}

.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-left: 48px;
}

.btn-toggle-password {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 8px;
    transition: color 0.3s;
}

.btn-toggle-password:hover {
    color: var(--primary-color);
}

.login-error {
    display: none;
    align-items: center;
    gap: 10px;
    background: #fef2f2;
    color: var(--danger-color);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    border-right: 4px solid var(--danger-color);
}

.login-error i {
    font-size: 18px;
}

.btn-login {
    width: 100%;
    padding: 15px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.35);
}

.btn-login:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(99, 102, 241, 0.45);
}

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

.btn-login.loading i {
    animation: spin 1s linear infinite;
}

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

.login-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.login-footer p {
    color: var(--text-muted);
    font-size: 13px;
}

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

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

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all 0.3s;
    direction: rtl;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-control::placeholder {
    color: #94a3b8;
}

textarea.form-control {
    resize: vertical;
    font-family: 'Segoe UI', monospace;
    font-size: 13px;
    line-height: 1.5;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
    transform: translateY(-1px);
}

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

.btn-success:hover {
    background-color: #059669;
}

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

.btn-danger:hover {
    background-color: #dc2626;
}

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

.btn-warning:hover {
    background-color: #d97706;
}

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

.btn-info:hover {
    background-color: #2563eb;
}

.btn-secondary {
    background-color: #64748b;
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.error-message {
    background-color: #fef2f2;
    color: var(--danger-color);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    border-right: 4px solid var(--danger-color);
}

.text-muted {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
}

.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 10px;
}

.mt-4 {
    margin-top: 20px;
}

/* ================= LAYOUT ================= */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    height: 60px;
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    z-index: 100;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}

.mobile-menu-toggle {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--dark-color);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: background 0.3s;
}

.mobile-menu-toggle:hover {
    background: var(--light-color);
}

.mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--dark-color);
    font-size: 16px;
}

.mobile-brand i {
    color: var(--primary-color);
    font-size: 20px;
}

.mobile-spacer {
    width: 38px;
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
}

.mobile-overlay.active {
    display: block;
}

.sidebar {
    position: fixed;
    right: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: var(--dark-color);
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 200;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header h2 i {
    color: var(--primary-light);
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    transition: all 0.3s;
    border-right: 3px solid transparent;
    font-size: 15px;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: white;
    border-right-color: var(--primary-light);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.2) 0%, transparent 100%);
    color: white;
    border-right-color: var(--primary-light);
}

.nav-item i {
    width: 24px;
    text-align: center;
    font-size: 16px;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px 0;
}

.main-content {
    margin-right: 260px;
    padding: 30px;
    min-height: 100vh;
    transition: margin-right 0.3s;
}

.page {
    display: none;
    animation: fadeIn 0.3s;
}

.page.active {
    display: block;
}

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

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
    flex-wrap: wrap;
    gap: 15px;
}

.page-header h1 {
    font-size: 26px;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
}

.page-header h1 i {
    color: var(--primary-color);
}

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

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
    border: 1px solid var(--border-color);
}

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

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
    flex-shrink: 0;
}

.stat-icon.bg-blue {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-icon.bg-green {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stat-icon.bg-orange {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.stat-icon.bg-purple {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.stat-info h3 {
    font-size: 24px;
    margin-bottom: 4px;
    font-weight: 700;
    color: var(--dark-color);
}

.stat-info p {
    color: var(--text-muted);
    font-size: 13px;
}

/* ================= CONTROL PANEL ================= */
.control-panel {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
}

.control-panel h2 {
    margin-bottom: 18px;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 700;
}

.service-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ================= USERS TABLE ================= */
.users-table-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    border: 1px solid var(--border-color);
}

.users-table-container h3 {
    margin-bottom: 18px;
    color: var(--dark-color);
    font-size: 18px;
    font-weight: 700;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.users-table thead {
    background-color: var(--light-color);
}

.users-table th,
.users-table td {
    padding: 14px 12px;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

.users-table th {
    font-weight: 700;
    color: var(--dark-color);
    font-size: 13px;
    white-space: nowrap;
}

.users-table td {
    font-size: 14px;
    color: var(--text-color);
}

.users-table tr:hover {
    background-color: var(--bg-color);
}

.users-table .actions {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
}

.users-table .actions .btn {
    padding: 6px 12px;
    font-size: 12px;
}

/* ================= SERVICE INFO ================= */
.service-info-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
}

.service-info-card h3 {
    margin-bottom: 20px;
    color: var(--dark-color);
    font-size: 18px;
    font-weight: 700;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-color);
    border-radius: var(--radius-sm);
    align-items: center;
}

.info-item label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 13px;
}

.info-item span {
    color: var(--dark-color);
    font-weight: 700;
    font-size: 14px;
}

/* ================= BACKUP & SETTINGS ================= */
.backup-section,
.settings-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.backup-section h3,
.settings-card h3 {
    margin-bottom: 20px;
    color: var(--dark-color);
    font-size: 18px;
    font-weight: 700;
}

/* ================= MODAL ================= */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    overflow: auto;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--card-bg);
    margin: 30px auto;
    padding: 0;
    border-radius: var(--radius);
    width: 100%;
    max-width: 620px;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s;
    overflow: hidden;
}

@keyframes modalSlideIn {
    from { transform: translateY(-30px) scale(0.95); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

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

.modal-header h2 {
    color: var(--dark-color);
    font-size: 20px;
    font-weight: 700;
}

.close {
    color: var(--text-muted);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
    line-height: 1;
}

.close:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 18px 25px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

/* ================= QR CODE ================= */
.qr-code-container {
    display: flex;
    justify-content: center;
    padding: 20px;
    background: white;
    border-radius: var(--radius-sm);
    margin-top: 10px;
    border: 1px solid var(--border-color);
}

.qr-code-container img {
    max-width: 220px;
    width: 100%;
}

/* ================= SUBSCRIPTION ================= */
.subscription-group {
    background: var(--light-color);
    padding: 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.subscription-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--dark-color);
    font-weight: 700;
}

.subscription-group label i {
    color: var(--primary-color);
}

.subscription-input-wrapper {
    display: flex;
    gap: 8px;
    margin: 10px 0;
}

.subscription-input-wrapper .form-control {
    flex: 1;
    font-size: 12px;
    direction: ltr;
    text-align: left;
}

.subscription-input-wrapper .btn {
    flex-shrink: 0;
}

/* ================= CONNECTIONS ================= */
.connections-container {
    background: var(--bg-color);
    border-radius: var(--radius-sm);
    padding: 20px;
    min-height: 150px;
}

.connections-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.connection-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    background: white;
    border-radius: var(--radius-sm);
    border-right: 4px solid var(--primary-color);
    flex-wrap: wrap;
    gap: 10px;
}

.connection-item strong {
    color: var(--dark-color);
}

.connection-item span {
    color: var(--text-muted);
    font-size: 13px;
}

.status-online {
    color: var(--secondary-color);
    font-weight: 700;
}

.status-offline {
    color: var(--danger-color);
    font-weight: 700;
}

/* ================= CHECKBOX ================= */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.checkbox-label {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    cursor: pointer;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-color);
    transition: background 0.3s;
    gap: 10px;
}

.checkbox-label:hover {
    background: var(--light-color);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin-top: 2px;
    flex-shrink: 0;
}

.checkbox-label span {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 14px;
}

.checkbox-label small {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}

/* ================= RESPONSIVE ================= */
@media (max-width: 1024px) {
    .main-content {
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }

    .sidebar {
        transform: translateX(100%);
        width: 280px;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-right: 0;
        padding: 80px 15px 15px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .page-header h1 {
        font-size: 20px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-icon {
        width: 46px;
        height: 46px;
        font-size: 18px;
    }

    .stat-info h3 {
        font-size: 18px;
    }

    .service-controls {
        flex-direction: column;
    }

    .service-controls .btn {
        width: 100%;
    }

    .modal {
        padding: 10px;
    }

    .modal-content {
        margin: 10px auto;
        max-height: calc(100vh - 20px);
        overflow-y: auto;
    }

    .modal-body {
        padding: 18px;
    }

    .modal-footer {
        padding: 15px 18px;
    }

    .subscription-input-wrapper {
        flex-direction: column;
    }

    .subscription-input-wrapper .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 28px 22px;
        border-radius: 20px;
    }

    .login-header h1 {
        font-size: 24px;
    }

    .logo-icon {
        width: 70px;
        height: 70px;
        font-size: 30px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .users-table {
        font-size: 12px;
    }

    .users-table th,
    .users-table td {
        padding: 10px 8px;
    }

    .btn {
        padding: 10px 18px;
        font-size: 13px;
    }

    .control-panel,
    .settings-card,
    .backup-section,
    .service-info-card,
    .users-table-container {
        padding: 18px;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .info-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

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

.empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
    display: block;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

