/* ===================================
   СБП VPN - Dashboard стили
   =================================== */

.dashboard-page {
    display: flex;
    min-height: 100vh;
    background: var(--dark);
    overflow-x: hidden;
}

/* ===================================
   Sidebar
   =================================== */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    background: var(--dark-light);
    border-right: 1px solid rgba(99, 102, 241, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: var(--transition);
}

.sidebar-header {
    padding: 25px;
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--gray);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    transition: var(--transition);
}

.sidebar-toggle:hover {
    color: var(--white);
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 25px;
    color: var(--gray-light);
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--gradient-primary);
    transform: scaleY(0);
    transition: var(--transition);
}

.nav-item:hover {
    color: var(--white);
    background: rgba(99, 102, 241, 0.05);
}

.nav-item.active {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.nav-item.active::before {
    transform: scaleY(1);
}

.nav-item i {
    font-size: 1.25rem;
    width: 24px;
}

.sidebar-footer {
    padding: 20px 25px;
    border-top: 1px solid rgba(99, 102, 241, 0.1);
}

.user-balance {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.balance-label {
    color: var(--gray);
    font-size: 0.875rem;
}

.balance-value {
    color: var(--white);
    font-weight: 700;
    font-size: 1.25rem;
}

/* ===================================
   Main Content
   =================================== */

.main-content {
    flex: 1;
    margin-left: 280px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
    padding: 15px 30px;
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 100;
}

.mobile-menu-toggle {
    background: none;
    border: none;
    color: var(--gray-light);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.btn-icon:hover {
    background: rgba(99, 102, 241, 0.2);
    color: var(--white);
}

.btn-icon .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    padding: 3px 6px;
    font-size: 0.65rem;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 15px;
    border-left: 1px solid rgba(99, 102, 241, 0.2);
}

.user-email {
    color: var(--gray-light);
    font-size: 0.9rem;
}

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

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

/* ===================================
   Content Wrapper
   =================================== */

.content-wrapper {
    flex: 1;
    padding: 30px;
}

.content-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.content-section.active {
    display: block;
}

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

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    gap: 20px;
    flex-wrap: wrap;
}

.section-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--white);
    margin: 0;
}

.section-subtitle {
    color: var(--gray-light);
    font-size: 1rem;
    margin: 5px 0 0;
}

/* ===================================
   Stats Cards
   =================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: var(--border-radius-lg);
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-5px);
}

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

.stat-content {
    flex: 1;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--white);
}

.stat-label {
    color: var(--gray);
    font-size: 0.875rem;
}

/* ===================================
   Quick Actions
   =================================== */

.quick-actions {
    margin-bottom: 40px;
}

.action-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.action-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: var(--border-radius-lg);
    padding: 25px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
    color: var(--light);
}

.action-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-5px);
    color: var(--white);
}

.action-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--white);
    margin: 0 auto 15px;
}

.action-card span {
    font-weight: 500;
    font-size: 0.9rem;
}

/* ===================================
   Subscriptions
   =================================== */

.subscriptions-list,
.payments-list,
.tickets-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.subscription-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: var(--border-radius-lg);
    padding: 25px;
    transition: var(--transition);
}

.subscription-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
}

.subscription-card.active {
    border-left: 3px solid var(--success);
}

.subscription-card.frozen {
    border-left: 3px solid var(--warning);
}

.subscription-card.expired {
    border-left: 3px solid var(--danger);
    opacity: 0.7;
}

.subscription-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.subscription-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.subscription-title h4 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--white);
    margin: 0;
}

.status-badge {
    padding: 5px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-badge.active {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.status-badge.frozen {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.status-badge.expired {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.subscription-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.subscription-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.subscription-info label {
    font-size: 0.8rem;
    color: var(--gray);
    text-transform: uppercase;
    font-weight: 600;
}

.subscription-info span {
    color: var(--light);
    font-size: 1rem;
}

.subscription-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ===================================
   Traffic Progress
   =================================== */

.traffic-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(99, 102, 241, 0.1);
}

.traffic-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.875rem;
}

.traffic-progress {
    height: 8px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.traffic-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* ===================================
   Profile
   =================================== */

.profile-content {
    max-width: 800px;
}

.profile-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: var(--border-radius-lg);
    padding: 30px;
    margin-bottom: 20px;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--white);
}

.profile-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
    margin: 0 0 5px;
}

.profile-info p {
    color: var(--gray);
    margin: 0;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.profile-stat {
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
}

.profile-stat .stat-label {
    display: block;
    color: var(--gray);
    font-size: 0.875rem;
    margin-bottom: 10px;
}

.profile-stat .stat-value {
    display: block;
    color: var(--primary);
    font-weight: 700;
    font-size: 1.25rem;
}

.profile-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* ===================================
   Referrals
   =================================== */

.referrals-content {
    max-width: 900px;
}

.referral-banner {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(14, 165, 233, 0.2) 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--border-radius-lg);
    padding: 30px;
    margin-bottom: 30px;
}

.referral-banner h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
    margin: 0 0 10px;
}

.referral-banner p {
    color: var(--gray-light);
    margin: 0;
}

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

.referral-value {
    display: block;
    font-size: 3rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.referral-label {
    color: var(--gray);
    font-size: 0.9rem;
}

.referral-link-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: var(--border-radius-lg);
    padding: 25px;
    margin-bottom: 20px;
}

.referral-link-wrapper {
    display: flex;
    gap: 10px;
}

.referral-link-wrapper .form-control {
    flex: 1;
    background: rgba(15, 23, 42, 0.6);
    font-family: monospace;
}

/* ===================================
   Loading
   =================================== */

.loading-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 20px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}

.empty-state i {
    font-size: 4rem;
    color: rgba(99, 102, 241, 0.3);
    margin-bottom: 20px;
}

.empty-state h4 {
    color: var(--light);
    margin-bottom: 10px;
}

/* ===================================
   Modal
   =================================== */

.modal-content {
    background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-header {
    border-bottom: 1px solid rgba(99, 102, 241, 0.2);
    background: rgba(15, 23, 42, 0.5);
}

.modal-footer {
    border-top: 1px solid rgba(99, 102, 241, 0.2);
    background: rgba(15, 23, 42, 0.3);
}

.modal-title {
    color: #f1f5f9;
    font-weight: 700;
}

.modal-body {
    color: #e2e8f0;
    padding: 1.5rem;
}

.modal-body .text-muted {
    color: #94a3b8 !important;
}

.modal-body .form-label {
    color: #cbd5e1;
    font-weight: 600;
}

.btn-close-white {
    filter: brightness(0) invert(1);
}

/* Tariff cards in modal */
.tariff-option {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.8) 100%);
    border: 2px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: var(--transition);
    color: #e2e8f0;
}

.tariff-option:hover {
    border-color: rgba(99, 102, 241, 0.5);
    background: linear-gradient(135deg, rgba(30, 41, 59, 1) 0%, rgba(15, 23, 42, 1) 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.2);
}

.tariff-option.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(14, 165, 233, 0.1) 100%);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.tariff-option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
}

.tariff-option-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: #f1f5f9;
}

.tariff-option-price {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tariff-option-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.tariff-feature {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: #94a3b8;
}

.tariff-feature i {
    color: #10b981;
    font-size: 0.75rem;
}

/* Subscription Full Details */
.subscription-full-details {
    color: #e2e8f0;
}

.subscription-full-details h4,
.subscription-full-details .fw-bold {
    color: #f1f5f9;
}

.subscription-full-details .text-muted {
    color: #94a3b8 !important;
}

.subscription-full-details .info-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.6) 0%, rgba(15, 23, 42, 0.6) 100%) !important;
    border: 1px solid rgba(99, 102, 241, 0.2) !important;
    transition: var(--transition);
}

.subscription-full-details .info-card:hover {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.9) 100%) !important;
    border-color: rgba(99, 102, 241, 0.4) !important;
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.2);
}

.traffic-info {
    font-size: 1.25rem;
    font-weight: 600;
    padding: 15px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(52, 211, 153, 0.1) 100%);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--border-radius);
    text-align: center;
    color: #34d399;
}

.devices-section {
    margin-top: 20px;
}

.device-item {
    transition: var(--transition);
    color: #e2e8f0;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.5) 0%, rgba(15, 23, 42, 0.5) 100%) !important;
    border: 1px solid rgba(99, 102, 241, 0.15) !important;
}

.device-item:hover {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.8) 100%) !important;
    border-color: rgba(99, 102, 241, 0.4) !important;
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.15);
}

.device-item .fw-bold {
    color: #f1f5f9;
}

.subscription-url-section .form-control {
    background: rgba(15, 23, 42, 0.8);
    border: 2px solid rgba(99, 102, 241, 0.3);
    font-family: monospace;
    color: #38bdf8;
}

.subscription-url-section .form-control:focus {
    background: rgba(15, 23, 42, 1);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Note Section */
.note-section textarea {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.8) 0%, rgba(30, 41, 59, 0.8) 100%);
    border: 2px solid rgba(99, 102, 241, 0.3);
    color: #e2e8f0;
    resize: vertical;
}

.note-section textarea:focus {
    background: linear-gradient(135deg, rgba(15, 23, 42, 1) 0%, rgba(30, 41, 59, 1) 100%);
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* QR Code Section */
.qr-code-section {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(241, 245, 249, 0.95) 100%);
    border-radius: var(--border-radius);
    margin: 20px 0;
    border: 2px solid rgba(99, 102, 241, 0.2);
}

.qr-code-section #qrCodeContainer {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Показываем только img (QRCode.js создает QR код в img) */
.qr-code-section #qrCodeCanvas img {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 200px !important;
    height: 200px !important;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    margin: 0 auto !important;
}

/* Скрываем canvas (он пустой) */
.qr-code-section #qrCodeCanvas canvas {
    display: none !important;
}

.qr-code-section .qr-label {
    color: #475569;
    font-weight: 600;
    margin-top: 15px;
    margin-bottom: 0;
    font-size: 0.9rem;
}

/* Auto Update Section */
.autoupdate-section .form-check-input {
    width: 3em;
    height: 1.5em;
    cursor: pointer;
    background-color: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
}

.autoupdate-section .form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.autoupdate-section .form-check-label {
    font-weight: 600;
    color: #e2e8f0;
    cursor: pointer;
}

/* Progress bar in modal */
.progress {
    background: rgba(30, 41, 59, 0.5);
    border-radius: 10px;
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 10px;
}

/* Badges */
.badge {
    color: #ffffff;
    font-weight: 600;
    padding: 6px 12px;
}

/* Buttons in modal */
.modal-body .btn {
    font-weight: 600;
    transition: var(--transition);
}

.modal-body .btn-outline-primary {
    color: #818cf8;
    border-color: #818cf8;
}

.modal-body .btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.modal-body .btn-outline-success {
    color: #34d399;
    border-color: #34d399;
}

.modal-body .btn-outline-success:hover {
    background: var(--success);
    border-color: var(--success);
    color: #ffffff;
}

.modal-body .btn-outline-danger {
    color: #f87171;
    border-color: #f87171;
}

.modal-body .btn-outline-danger:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #ffffff;
}

.modal-body .btn-outline-warning {
    color: #fbbf24;
    border-color: #fbbf24;
}

.modal-body .btn-outline-warning:hover {
    background: var(--warning);
    border-color: var(--warning);
    color: #1e293b;
}

/* ===================================
   Адаптивность
   =================================== */

@media (max-width: 992px) {
    .main-content {
        margin-left: 0;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .section-header {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .action-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .content-wrapper {
        padding: 15px;
    }
    
    .topbar {
        padding: 15px;
    }
    
    .user-email {
        display: none;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .action-cards {
        grid-template-columns: 1fr;
    }
    
    .subscription-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .subscription-actions {
        width: 100%;
    }
    
    .referral-link-wrapper {
        flex-direction: column;
    }
}

/* ===================================
   Overlay для мобильного меню
   =================================== */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.show {
    display: block;
}
