@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Roboto:wght@300;400;500;700&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');

:root {
    --bg-primary: #0a0b0e;
    --bg-secondary: #141517;
    --bg-card: #1e1f24;
    --bg-input: #2a2b31;
    --accent-primary: #3b82f6;
    --accent-secondary: #6366f1;
    --accent-glow: rgba(59, 130, 246, 0.3);
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --border-color: #2d2e33;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --card-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    --sidebar-width: 260px;
    --header-height: 70px;
}

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

body {
    font-family: 'Roboto', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

/* ==================== MAIN LAYOUT ==================== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
    width: 100%;
}

/* ==================== SIDEBAR - FIXED ==================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: all 0.3s ease;
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.sidebar-header h2 {
    font-size: 22px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}

.sidebar-header p {
    color: var(--text-secondary);
    font-size: 12px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
}

.nav-menu {
    list-style: none;
}

.nav-item {
    margin-bottom: 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 14px;
}

.nav-link i {
    width: 22px;
    margin-right: 12px;
    font-size: 16px;
    text-align: center;
}

.nav-link:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-link.active {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.nav-link.logout {
    margin-top: 20px;
    color: var(--danger);
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.nav-link.logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

.nav-link.contact {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-primary);
    width: calc(100% - var(--sidebar-width));
}

/* ==================== HEADER - FIXED ==================== */
.main-header {
    position: sticky;
    top: 0;
    z-index: 99;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.page-title h1 {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.page-title p {
    color: var(--text-secondary);
    font-size: 13px;
}

.page-title .back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    margin-top: 4px;
    padding: 6px 12px;
    background: var(--bg-card);
    border-radius: 30px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.page-title .back-link:hover {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 18px;
    text-transform: uppercase;
}

/* ==================== CONTENT AREA ==================== */
.content-area {
    padding: 24px;
    min-height: calc(100vh - var(--header-height));
}

/* ==================== STATS CARDS - FIXED GRID ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease;
}

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

.stat-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.stat-icon i {
    font-size: 20px;
    color: white;
}

.stat-info h3 {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 400;
}

.stat-info .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ==================== TABLES ==================== */
.table-container {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

.table-container h2 {
    font-size: 18px;
    margin-bottom: 16px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-input);
}

.data-table td {
    padding: 14px 16px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.data-table tbody tr:hover {
    background: var(--bg-input);
}

/* ==================== BUTTONS ==================== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--accent-glow);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-input);
}

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

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

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

.btn-block {
    width: 100%;
}

/* ==================== FORMS ==================== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.create-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border-color);
    max-width: 550px;
    margin: 0 auto;
}

/* ==================== PRICING CARDS ==================== */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.pricing-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease;
}

.pricing-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-primary);
}

.pricing-card.featured {
    border: 2px solid var(--accent-primary);
}

.price {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 16px 0;
}

.price span {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
}

.duration {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: -12px;
    margin-bottom: 20px;
}

.features-list {
    list-style: none;
    margin: 20px 0;
}

.features-list li {
    padding: 10px 0;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.features-list li i {
    color: var(--success);
    font-size: 13px;
}

/* ==================== CONTACT PAGE ==================== */
.contact-container {
    max-width: 500px;
    margin: 0 auto;
}

.contact-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 28px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.contact-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.contact-icon i {
    font-size: 32px;
    color: white;
}

.contact-info {
    margin: 24px 0;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--bg-input);
    border-radius: 12px;
    margin-bottom: 12px;
}

.contact-item i {
    font-size: 20px;
    color: var(--accent-primary);
}

.contact-item .label {
    color: var(--text-secondary);
    font-size: 12px;
}

.contact-item .value {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
}

.telegram-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #0088cc;
    color: white;
    padding: 14px 28px;
    border-radius: 40px;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: transform 0.2s ease;
}

.telegram-btn:hover {
    transform: translateY(-2px);
}

/* ==================== MODAL ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 28px;
    max-width: 380px;
    width: 100%;
    border: 1px solid var(--border-color);
    animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.modal-header h2 {
    font-size: 20px;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
}

.qr-container {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    text-align: center;
}

.qr-container img {
    max-width: 160px;
}

/* ==================== NOTIFICATIONS ==================== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 22px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 9999;
    max-width: 320px;
}

.notification.show {
    transform: translateX(0);
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.notification-success {
    border-left: 4px solid var(--success);
}

.notification-success i {
    color: var(--success);
}

.notification-error {
    border-left: 4px solid var(--danger);
}

.notification-error i {
    color: var(--danger);
}

/* ==================== MOBILE MENU ==================== */
.menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 18px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* ==================== BADGES ==================== */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    display: inline-block;
}

.badge-premium {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.badge-free {
    background: var(--bg-input);
    color: var(--text-secondary);
}

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

/* ==================== ACTION BUTTONS ==================== */
.action-buttons {
    display: flex;
    gap: 6px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: white;
    font-size: 14px;
}

.btn-icon.edit {
    background: var(--accent-primary);
}

.btn-icon.delete {
    background: var(--danger);
}

.btn-icon.copy {
    background: var(--success);
}

.btn-icon:hover {
    transform: scale(1.1);
}

/* ==================== LOADING ==================== */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

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

/* ==================== AUTH PAGES ==================== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.auth-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 32px;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-header h1 {
    font-size: 28px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 6px;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 13px;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 13px;
}

.auth-footer a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
}

/* ==================== RESPONSIVE DESIGN - MOBILE FIRST ==================== */

/* Tablet (768px to 1024px) */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .pricing-grid {
        gap: 15px;
    }
}

/* Mobile (up to 768px) */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 240px;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 2px 0 20px rgba(0,0,0,0.5);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .main-header {
        padding: 0 16px 0 70px;
        height: 60px;
    }
    
    .page-title h1 {
        font-size: 18px;
    }
    
    .page-title p {
        font-size: 12px;
    }
    
    .content-area {
        padding: 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-icon {
        width: 38px;
        height: 38px;
        margin-bottom: 10px;
    }
    
    .stat-info .stat-value {
        font-size: 22px;
    }
    
    .pricing-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .table-container {
        padding: 16px;
    }
    
    .table-container h2 {
        font-size: 16px;
    }
    
    .create-card {
        padding: 20px;
    }
    
    .user-avatar {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }
    
    .contact-card {
        padding: 20px;
    }
    
    .contact-icon {
        width: 60px;
        height: 60px;
    }
    
    .contact-icon i {
        font-size: 28px;
    }
    
    .telegram-btn {
        padding: 12px 24px;
        font-size: 14px;
    }
    
    .notification {
        left: 16px;
        right: 16px;
        max-width: none;
        transform: translateY(-400px);
    }
    
    .notification.show {
        transform: translateY(0);
    }
}

/* Small Mobile (up to 480px) */
@media (max-width: 480px) {
    .main-header {
        padding: 0 12px 0 65px;
    }
    
    .page-title h1 {
        font-size: 16px;
    }
    
    .page-title p {
        font-size: 11px;
    }
    
    .user-avatar {
        width: 34px;
        height: 34px;
        font-size: 14px;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .modal-content {
        padding: 20px;
    }
    
    .price {
        font-size: 32px;
    }
}

/* Fix for very small devices */
@media (max-width: 360px) {
    .main-header {
        padding: 0 8px 0 60px;
    }
    
    .page-title h1 {
        font-size: 15px;
    }
    
    .content-area {
        padding: 12px;
    }
}