@font-face {
    font-family: 'ir-s';
    src: url('../fonts/ir-s.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

:root {
    --bg-main: #0a0c10;
    --sidebar-bg: rgba(18, 22, 29, 0.75);
    --topbar-bg: rgba(18, 22, 29, 0.75);
    --card-bg: rgba(22, 27, 34, 0.8);
    --card-bg-elevated: #1e2430;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.16);
    --glass-blur: blur(20px);
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-glow: rgba(59, 130, 246, 0.35);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --radius-lg: 15px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --card-shadow: 0 12px 35px rgba(0, 0, 0, 0.45);
    --floating-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--border-color);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    box-sizing: border-box;
    font-family: 'ir-s', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    direction: rtl;
    text-align: right;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    min-height: 100vh;
}

.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.apple-sidebar {
    width: 270px;
    position: fixed;
    top: 30px;
    right: 30px;
    bottom: 30px;
    height: calc(100vh - 60px);
    background: var(--sidebar-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--floating-shadow);
    display: flex;
    flex-direction: column;
    padding: 24px 18px;
    z-index: 1000;
    transition: var(--transition);
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), #1d4ed8);
    color: #ffffff;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px var(--primary-glow);
    transition: var(--transition);
}

.brand-logo-img {
    width: 70px;
    height: 70px;
    object-fit: contain;
}

.free-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    font-size: 0.72rem;
    font-weight: 400;
    color: #4ade80;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(74, 222, 128, 0.3);
    border-radius: 50px;
}

.free-badge::before {
    content: '';
    width: 5px;
    height: 5px;
    background-color: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 6px #22c55e;
}

.brand-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 18px;
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav::-webkit-scrollbar {
    display: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 300;
    border-radius: var(--radius-md);
    transition: var(--transition);
    position: relative;
    border: 1px solid transparent;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    stroke: var(--text-muted);
    transition: var(--transition);
    flex-shrink: 0;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    transform: translateX(-4px);
}

.nav-item:hover svg {
    stroke: #ffffff;
    transform: scale(1.1);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary), #2563eb);
    color: #ffffff;
    box-shadow: 0 6px 20px var(--primary-glow);
}

.nav-item.active svg {
    stroke: #ffffff;
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.main-wrapper {
    flex: 1;
    margin-right: 330px;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding-bottom: 40px;
}

.apple-topbar {
    height: 68px;
    margin: 30px 30px 0 30px;
    background: var(--topbar-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--floating-shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 30px;
    z-index: 90;
    transition: var(--transition);
    font-weight: 300;
    gap: 16px;
}

.topbar-capsule {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 50px;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    transition: var(--transition);
}

.topbar-capsule:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-light);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.35);
}

.capsule-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.84rem;
    font-weight: 300;
    color: var(--text-muted);
}

.cap-icon {
    width: 17px;
    height: 17px;
    stroke: var(--text-muted);
    transition: var(--transition);
    flex-shrink: 0;
}

.cap-label {
    font-weight: 300;
    color: var(--text-dim);
}

.cap-value {
    font-weight: 300;
    color: var(--text-main);
    letter-spacing: 0.3px;
}

.capsule-item:hover .cap-icon {
    transform: scale(1.15);
}

.stat-total:hover .cap-icon { stroke: var(--primary); }
.stat-ssh:hover .cap-icon { stroke: #38bdf8; }
.stat-ovpn:hover .cap-icon { stroke: #a855f7; }
.clock-box:hover .cap-icon { stroke: #f59e0b; }
.admin-ip-box:hover .cap-icon { stroke: #10b981; }

.pulse-badge {
    color: #60a5fa;
    font-weight: 400;
}

.ip-text {
    font-family: monospace;
    font-size: 0.8rem;
    color: #93c5fd;
}

.capsule-divider {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.1);
}

.capsule-btn-logout {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 30px;
    color: #f87171;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 300;
    transition: var(--transition);
}

.capsule-btn-logout svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    transition: var(--transition);
}

.capsule-btn-logout:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.capsule-btn-logout:hover svg {
    transform: translateX(-3px);
}

.content-body {
    padding: 24px 30px 0 30px;
    flex: 1;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

@media (max-width: 992px) {
    .main-wrapper {
        margin-right: 0 !important;
        padding-bottom: 100px !important;
    }

    .apple-topbar {
        height: auto !important;
        margin: 14px 14px 0 14px !important;
        top: 14px !important;
        padding: 10px !important;
        flex-direction: column !important;
        gap: 8px !important;
    }

    .topbar-capsule {
        width: 100% !important;
        justify-content: space-around !important;
        padding: 8px 10px !important;
        border-radius: 12px !important;
    }

    .cap-label {
        display: none !important;
    }

    .content-body {
        padding: 16px 14px 0 14px !important;
    }

    .apple-sidebar {
        top: auto !important;
        bottom: 14px !important;
        right: 14px !important;
        left: 14px !important;
        width: auto !important;
        height: 62px !important;
        padding: 0 8px !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-around !important;
        border-radius: 50px !important;
        background: rgba(18, 22, 29, 0.95) !important;
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.85), 0 0 0 1px var(--border-light) !important;
        z-index: 9999 !important;
    }

    .apple-sidebar .sidebar-brand,
    .apple-sidebar .sidebar-footer,
    .apple-sidebar .free-badge,
    .apple-sidebar .brand-name,
    .apple-sidebar .brand-logo-img,
    .apple-sidebar .brand-icon {
        display: none !important;
    }

    .apple-sidebar .sidebar-nav {
        margin-top: 0 !important;
        flex-direction: row !important;
        justify-content: space-around !important;
        align-items: center !important;
        width: 100% !important;
        height: 100% !important;
        gap: 4px !important;
        overflow: visible !important;
    }

    .apple-sidebar .nav-item {
        flex: 1 !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 8px 0 !important;
        height: 46px !important;
        border-radius: 12px !important;
        transform: none !important;
        gap: 0 !important;
    }

    .apple-sidebar .nav-item span {
        display: none !important;
    }

    .apple-sidebar .nav-item svg {
        width: 22px !important;
        height: 22px !important;
        margin: 0 !important;
    }

    .apple-sidebar .nav-item.active {
        background: rgba(59, 130, 246, 0.25) !important;
        border: 1px solid rgba(59, 130, 246, 0.5) !important;
    }

    .apple-sidebar .nav-item.active svg {
        stroke: #60a5fa !important;
    }
}
