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

:root {
    --primary: #2b6cb0;
    --primary-light: #bee3f8;
    --success: #48bb78;
    --danger: #f56565;
    --text-main: #2d3748;
    --text-muted: #718096;
    --bg-body: #f7fafc;
    --bg-card: #ffffff;
    --border-color: #edf2f7;
    --sidebar-w: 260px;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; }

html, body { height: 100%; }

body { 
    background-color: var(--bg-body); 
    color: var(--text-main); 
    display: flex; 
    min-height: 100vh; 
}

/* --- Сайдбар (Десктоп) --- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-card);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0,0,0,0.02);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.logo { font-size: 24px; font-weight: 700; color: var(--primary); margin-bottom: 40px; display: flex; align-items: center; gap: 10px; }
.logo i { font-size: 28px; color: #ecc94b; }

.user-profile { text-align: center; margin-bottom: 30px; }
.avatar { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; margin-bottom: 15px; border: 3px solid var(--primary-light); }
.user-name { font-weight: 600; font-size: 16px; }
.user-status { font-size: 13px; color: var(--text-muted); margin-top: 5px; }
.status-badge { background: var(--primary-light); color: var(--primary); padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; display: inline-block; margin-top: 5px; }

.balance-box { background: var(--primary-light); border-radius: 12px; padding: 15px; margin-bottom: 30px; }
.balance-box div { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 14px; }
.balance-box div:last-child { margin-bottom: 0; }
.balance-box strong { color: var(--primary); }

.menu { list-style: none; flex: 1; }
.menu li { margin-bottom: 5px; }
.menu a { display: flex; align-items: center; gap: 15px; padding: 12px 15px; text-decoration: none; color: var(--text-muted); border-radius: 10px; font-weight: 500; transition: 0.2s; }
.menu a:hover, .menu a.active { background: var(--primary-light); color: var(--primary); }
.menu a i { width: 20px; text-align: center; }

/* --- Основной контент --- */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 40px;
    width: calc(100% - var(--sidebar-w));
    transition: margin 0.3s ease;
}

.header-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.page-title { font-size: 24px; font-weight: 600; }

.top-icons { display: flex; gap: 15px; }
.icon-btn { width: 45px; height: 45px; border-radius: 50%; background: var(--bg-card); display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 10px rgba(0,0,0,0.05); color: var(--text-muted); cursor: pointer; position: relative; border: none; font-size: 18px; }
.icon-btn:hover { color: var(--primary); }

/* --- Сетка карточек --- */
.grid-dashboard { display: grid; grid-template-columns: repeat(3, 1fr); gap: 25px; margin-bottom: 30px; }

.card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}

.card-balance { color: white; position: relative; overflow: hidden; }
.card-balance h3 { font-weight: 400; font-size: 16px; opacity: 0.9; margin-bottom: 10px; }
.card-balance .amount { font-size: 28px; font-weight: 700; margin-bottom: 20px; }
.card-balance .card-info { display: flex; justify-content: space-between; font-size: 12px; opacity: 0.8; text-transform: uppercase; letter-spacing: 1px; }

.bg-green { background: linear-gradient(135deg, #48bb78, #38a169); }
.bg-blue { background: linear-gradient(135deg, #4299e1, #2b6cb0); }
.bg-purple { background: linear-gradient(135deg, #9f7aea, #805ad5); }

/* --- Формы (логин/регистрация) --- */
.auth-wrapper { display: flex; align-items: center; justify-content: center; min-height: 100vh; width: 100%; background: var(--bg-body); padding: 20px; }
.auth-card { width: 100%; max-width: 450px; padding: 40px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; font-size: 14px; color: var(--text-main); }
.form-control { width: 100%; padding: 14px 15px; border: 1px solid var(--border-color); border-radius: 10px; font-size: 15px; outline: none; transition: 0.2s; background: #f8fafc; }
.form-control:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-light); }
.btn { width: 100%; padding: 15px; border-radius: 10px; border: none; background: var(--primary); color: white; font-size: 16px; font-weight: 600; cursor: pointer; transition: 0.2s; display: inline-block; text-align: center; text-decoration: none; }
.btn:hover { background: #2c5282; }

.auth-links { display: flex; justify-content: space-between; margin-top: 20px; font-size: 14px; }
.auth-links a { color: var(--primary); text-decoration: none; font-weight: 500; }
.auth-links a:hover { text-decoration: underline; }

/* --- Алерты --- */
.alert { padding: 15px; border-radius: 10px; margin-bottom: 20px; font-size: 14px; font-weight: 500; text-align: center; }
.alert-danger { background: #fff5f5; color: var(--danger); border: 1px solid #fed7d7; }
.alert-success { background: #f0fff4; color: var(--success); border: 1px solid #c6f6d5; }

/* --- Мобильный хедер (скрыт на десктопе) --- */
.mobile-header {
    display: none;
    background: var(--bg-card);
    padding: 12px 20px;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 900;
    width: 100%;
}

.burger-btn {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-main);
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: background 0.2s;
}
.burger-btn:active { background: var(--primary-light); }

/* Оверлей */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Кнопка закрытия внутри сайдбара */
.sidebar-close {
    display: none;
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255,255,255,0.25);
    color: #fff;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(4px);
}

/* ===================================
   МОБИЛЬНАЯ ВЕРСИЯ (<= 768px)
   =================================== */
@media (max-width: 768px) {
    /* КРИТИЧНО: отключаем flex у body, чтобы элементы не сжимались в ряд */
    body { 
        display: block !important; 
        height: auto;
        min-height: 100vh;
    }
    body.menu-open { overflow: hidden; }

    /* Основной контент */
    .main-content { 
        margin-left: 0 !important; 
        width: 100% !important; 
        padding: 16px; 
    }
    
    .mobile-header { display: flex; }
    .grid-dashboard { grid-template-columns: 1fr; gap: 16px; }
    .header-top { display: none; }
    .auth-card { padding: 25px; }

    /* --- САЙДБАР: настоящий выезжающий drawer --- */
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 300px !important;
        max-width: 85vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        padding: 0 !important;
        margin: 0 !important;
        border-radius: 0 !important;
        background: var(--bg-card) !important;
        box-shadow: none;
        overflow-y: auto;
        z-index: 1000 !important;
        transform: translateX(-100%) !important;
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
        display: flex !important;
        flex-direction: column;
    }

    .sidebar.open {
        transform: translateX(0) !important;
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.2) !important;
    }

    /* Шапка с градиентом */
    .sidebar .logo {
        margin: 0 !important;
        padding: 20px 20px 16px !important;
        background: linear-gradient(135deg, var(--primary), #4299e1) !important;
        color: #fff !important;
        font-size: 20px !important;
        border-radius: 0 !important;
        flex-shrink: 0;
        width: 100%;
    }
    .sidebar .logo i { color: #ecc94b !important; font-size: 22px; }

    .sidebar-close { display: flex !important; }

    /* Профиль */
    .sidebar .user-profile {
        padding: 20px !important;
        margin: 0 !important;
        text-align: center;
        border-bottom: 1px solid var(--border-color);
        flex-shrink: 0;
        width: 100%;
    }
    .sidebar .avatar {
        width: 64px !important;
        height: 64px !important;
        margin-bottom: 10px;
    }
    .sidebar .user-name { font-size: 15px; }
    .sidebar .user-status {
        font-size: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Баланс */
    .sidebar .balance-box {
        margin: 16px 20px !important;
        padding: 12px 15px !important;
        border-radius: 12px !important;
        flex-shrink: 0;
        width: calc(100% - 40px) !important;
    }

    /* Меню */
    .sidebar .menu {
        padding: 8px 12px 24px !important;
        flex: 1;
        margin: 0 !important;
        width: 100%;
    }
    .sidebar .menu a {
        padding: 12px 14px !important;
        font-size: 14px !important;
    }
}

/* Планшеты */
@media (max-width: 992px) and (min-width: 769px) {
    .grid-dashboard { grid-template-columns: repeat(2, 1fr); }
}
/* Финансы - мобильная адаптация */
@media (max-width: 768px) {
    .finance-tabs { flex-direction: column; }
    .payment-methods { grid-template-columns: repeat(2, 1fr); }
    .amount-input button { padding: 12px 15px; font-size: 14px; }
}
/* Убираем стрелки у числовых полей */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
}