/* ============================================================
   RESET & BASE
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    min-height: 100vh;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    direction: rtl;
    background: #05080f;
    color: #e0e4f0;
    line-height: 1.6;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(ellipse at 20% 50%, rgba(91, 140, 255, 0.08) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 20%, rgba(167, 139, 250, 0.06) 0%, transparent 50%),
                #05080f;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0a0d1a; }
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #5b8cff, #a78bfa);
    border-radius: 10px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary, .btn-secondary {
    display: inline-block;
    padding: 13px 28px;
    border: none;
    border-radius: 50px;
    font-weight: 700;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}
.btn-primary {
    background: linear-gradient(135deg, #5b8cff, #a78bfa);
    color: #fff;
    box-shadow: 0 4px 20px rgba(91, 140, 255, 0.3);
}
.btn-primary:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 8px 35px rgba(91, 140, 255, 0.5);
}
.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: #ccc;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.btn-secondary:hover {
    background: rgba(91, 140, 255, 0.12);
    border-color: rgba(91, 140, 255, 0.3);
    color: #fff;
    transform: translateY(-3px);
}
.btn-danger {
    background: rgba(255, 69, 100, 0.12);
    color: #ff4564;
    border: 1px solid rgba(255, 69, 100, 0.15);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.3s;
    font-size: clamp(0.7rem, 1vw, 0.85rem);
}
.btn-danger:hover {
    background: rgba(255, 69, 100, 0.25);
    border-color: rgba(255, 69, 100, 0.4);
}

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
    background: rgba(5, 8, 15, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(91, 140, 255, 0.06);
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}
.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
    gap: 8px 12px;
    padding: 8px 0;
}
.navbar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    font-weight: 900;
    color: #5b8cff;
    text-decoration: none;
}
.navbar-logo i {
    font-size: clamp(1.4rem, 3.5vw, 2rem);
}
.navbar-logo span {
    background: linear-gradient(135deg, #5b8cff, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.navbar-links {
    display: flex;
    align-items: center;
    gap: 4px 8px;
    flex-wrap: wrap;
    flex: 1 1 auto;
    justify-content: flex-end;
}
.navbar-links a {
    color: #8892b0;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 8px;
    transition: all 0.3s;
    font-size: clamp(0.7rem, 1.1vw, 0.9rem);
    text-decoration: none;
    position: relative;
}
.navbar-links a::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #5b8cff, #a78bfa);
    transition: width 0.3s;
    border-radius: 2px;
}
.navbar-links a:hover::after,
.navbar-links a.active::after {
    width: 60%;
}
.navbar-links a:hover {
    color: #fff;
    background: rgba(91, 140, 255, 0.08);
}
.navbar-links a.active {
    color: #5b8cff;
    background: rgba(91, 140, 255, 0.1);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #e0e4f0;
    font-weight: 600;
    padding: 4px 10px 4px 4px;
    border-radius: 30px;
    background: rgba(91, 140, 255, 0.08);
    border: 1px solid rgba(91, 140, 255, 0.15);
    white-space: nowrap;
    font-size: clamp(0.7rem, 1vw, 0.85rem);
}
.user-badge .avatar {
    width: clamp(28px, 4vw, 36px);
    height: clamp(28px, 4vw, 36px);
    border-radius: 50%;
    background: linear-gradient(135deg, #5b8cff, #a78bfa);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: clamp(0.7rem, 1.2vw, 1rem);
    color: #fff;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: clamp(0.6rem, 0.9vw, 0.75rem);
    font-weight: 600;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    cursor: default;
    white-space: nowrap;
}
.status-badge i { font-size: clamp(0.5rem, 0.7vw, 0.65rem); }
.status-badge.online {
    border-color: rgba(0, 255, 136, 0.3);
    color: #00ff88;
    background: rgba(0, 255, 136, 0.06);
}
.status-badge.offline {
    border-color: rgba(255, 69, 100, 0.3);
    color: #ff4564;
    background: rgba(255, 69, 100, 0.06);
}
.status-badge.checking {
    border-color: rgba(255, 179, 71, 0.3);
    color: #ffb347;
    background: rgba(255, 179, 71, 0.06);
}
.status-badge.checking i { animation: spin 1s linear infinite; }
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 20px 16px;
}
.page {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    display: none;
    animation: fadeInUp 0.5s ease;
}
.page.active { display: block; }
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
    text-align: center;
    padding: clamp(30px, 6vw, 60px) clamp(15px, 3vw, 30px);
    background: radial-gradient(ellipse at 50% 0%, rgba(91, 140, 255, 0.05), transparent 70%);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}
.hero h1 {
    font-size: clamp(2rem, 8vw, 3.8rem);
    font-weight: 900;
    background: linear-gradient(135deg, #5b8cff, #a78bfa, #f472b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% 200%;
    animation: gradientMove 6s ease-in-out infinite;
    line-height: 1.2;
}
@keyframes gradientMove {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}
.hero p {
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    color: #8892b0;
    margin: 16px 0 30px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}
.hero-stats {
    display: flex;
    justify-content: center;
    gap: clamp(12px, 3vw, 40px);
    margin: 25px 0 30px;
    flex-wrap: wrap;
}
.hero-stats .stat-item {
    text-align: center;
    padding: clamp(8px, 1.5vw, 16px) clamp(12px, 2vw, 25px);
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    min-width: clamp(70px, 15vw, 120px);
    flex: 1 1 auto;
    max-width: 180px;
}
.hero-stats .stat-number {
    font-size: clamp(1.8rem, 5vw, 3rem);
    font-weight: 900;
    background: linear-gradient(135deg, #5b8cff, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: block;
}
.hero-stats .stat-label {
    color: #8892b0;
    font-size: clamp(0.7rem, 1.2vw, 0.9rem);
}

/* ============================================================
   FEATURES
   ============================================================ */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: clamp(12px, 2vw, 25px);
    margin-top: 30px;
}
.feature-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    padding: clamp(20px, 3vw, 32px) clamp(12px, 2vw, 24px);
    text-align: center;
    transition: all 0.3s ease;
}
.feature-card:hover {
    transform: translateY(-8px);
    border-color: rgba(91, 140, 255, 0.2);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}
.feature-card i {
    font-size: clamp(2rem, 5vw, 2.8rem);
    background: linear-gradient(135deg, #5b8cff, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    display: inline-block;
}
.feature-card h3 {
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    margin-bottom: 6px;
    color: #fff;
}
.feature-card p {
    color: #8892b0;
    font-size: clamp(0.7rem, 1vw, 0.85rem);
}

/* ============================================================
   AUTH FORMS
   ============================================================ */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 20px 12px;
}
.auth-box {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 24px;
    padding: clamp(24px, 5vw, 45px) clamp(16px, 4vw, 40px);
    width: 100%;
    max-width: 420px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.auth-box h2 {
    text-align: center;
    margin-bottom: 24px;
    font-size: clamp(1.4rem, 4vw, 2rem);
    font-weight: 800;
    background: linear-gradient(135deg, #5b8cff, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.auth-box h2 i {
    color: #5b8cff;
    margin-left: 8px;
}
.auth-box .form-group {
    margin-bottom: 16px;
}
.auth-box label {
    display: block;
    margin-bottom: 4px;
    color: #8892b0;
    font-size: clamp(0.75rem, 1.2vw, 0.9rem);
    font-weight: 500;
}
.auth-box input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    color: #e0e4f0;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    transition: all 0.3s;
}
.auth-box input:focus {
    outline: none;
    border-color: #5b8cff;
    box-shadow: 0 0 0 4px rgba(91, 140, 255, 0.1);
    background: rgba(91, 140, 255, 0.04);
}
.auth-box .btn-primary {
    width: 100%;
    margin-top: 8px;
    padding: 14px;
    font-size: clamp(0.9rem, 1.2vw, 1.05rem);
}
.auth-switch {
    text-align: center;
    margin-top: 16px;
    color: #8892b0;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
}
.auth-switch a {
    color: #5b8cff;
    font-weight: 600;
}
.auth-switch a:hover { text-decoration: underline; }
.auth-message {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    text-align: center;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    display: none;
}
.auth-message.error {
    display: block;
    background: rgba(255, 69, 100, 0.12);
    color: #ff4564;
    border: 1px solid rgba(255, 69, 100, 0.15);
}
.auth-message.success {
    display: block;
    background: rgba(0, 255, 136, 0.08);
    color: #00ff88;
    border: 1px solid rgba(0, 255, 136, 0.12);
}

/* ============================================================
   DASHBOARD
   ============================================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: clamp(16px, 3vw, 28px);
}
.dashboard-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    padding: clamp(18px, 3vw, 28px);
    transition: all 0.3s;
}
.dashboard-card:hover {
    border-color: rgba(91, 140, 255, 0.12);
}
.dashboard-card h3 {
    margin-bottom: 16px;
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    color: #fff;
    font-weight: 700;
}
.dashboard-card h3 i {
    color: #5b8cff;
    margin-left: 8px;
}
.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: #8892b0;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    flex-wrap: wrap;
    gap: 4px 8px;
}
.info-row span:last-child {
    color: #e0e4f0;
    font-weight: 500;
}

/* ============================================================
   ADMIN
   ============================================================ */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}
.admin-header h2 {
    font-size: clamp(1.2rem, 3vw, 2rem);
    font-weight: 800;
}
.admin-header h2 i {
    color: #f59e0b;
    margin-left: 8px;
}
.admin-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.stat-mini {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    padding: 10px 18px;
    text-align: center;
    min-width: 70px;
}
.stat-mini .num {
    display: block;
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 900;
    color: #5b8cff;
}
.stat-mini .label {
    color: #8892b0;
    font-size: clamp(0.6rem, 0.9vw, 0.75rem);
}
.admin-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.admin-table-wrapper {
    overflow-x: auto;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    -webkit-overflow-scrolling: touch;
    width: 100%;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: clamp(0.7rem, 1vw, 0.9rem);
    min-width: 500px;
}
.admin-table th {
    background: rgba(255, 255, 255, 0.04);
    padding: 10px 14px;
    text-align: right;
    font-weight: 700;
    color: #8892b0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.admin-table td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
.admin-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
    text-align: center;
    padding: clamp(16px, 3vw, 28px) 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    color: #4a4f6a;
    font-size: clamp(0.7rem, 1vw, 0.85rem);
    flex-shrink: 0;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 992px) {
    .navbar-container {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 8px 0;
        min-height: auto;
    }
    .navbar-logo { justify-content: center; }
    .navbar-links {
        justify-content: center;
        flex-wrap: wrap;
        gap: 4px 6px;
    }
}
@media (max-width: 768px) {
    .hero { padding: 30px 12px 24px; border-radius: 16px; }
    .hero h1 { font-size: clamp(1.6rem, 5vw, 2.2rem); }
    .hero p { font-size: clamp(0.85rem, 2vw, 1rem); }
    .hero-stats .stat-item { padding: 8px 12px; min-width: 60px; flex: 1 1 80px; }
    .hero-stats .stat-number { font-size: clamp(1.4rem, 4vw, 2rem); }
    .features-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
    .dashboard-grid { grid-template-columns: 1fr; gap: 16px; }
    .auth-box { padding: 24px 16px; }
    .admin-header { flex-direction: column; align-items: stretch; }
    .admin-stats { justify-content: center; gap: 8px; }
    .admin-table { font-size: 0.7rem; min-width: 400px; }
}
@media (max-width: 480px) {
    .navbar-links a { font-size: 0.6rem; padding: 3px 5px; }
    .status-badge { font-size: 0.5rem; padding: 2px 6px; }
    .user-badge { font-size: 0.6rem; padding: 2px 6px 2px 2px; }
    .user-badge .avatar { width: 22px; height: 22px; font-size: 0.6rem; }
    .hero h1 { font-size: 1.4rem; }
    .features-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .auth-box { padding: 16px 12px; }
    .admin-table { font-size: 0.6rem; min-width: 320px; }
}