/* Стили для страниц авторизации, админки и профиля.
   Используют те же CSS-переменные, что и основной интерфейс. */

:root {
    --primary: #1976d2;
    --primary-dark: #1565c0;
    --success: #2e7d32;
    --danger: #d32f2f;
    --warning: #ed6c02;
    --bg-main: #f5f5f5;
    --bg-card: #ffffff;
    --text-primary: #212121;
    --text-secondary: #757575;
    --border: #e0e0e0;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif; background: var(--bg-main); color: var(--text-primary); line-height: 1.6; }

/* Навигация */
.top-nav {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 12px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.nav-brand { font-size: 1.1rem; font-weight: 700; color: var(--primary); }
.nav-links { display: flex; gap: 20px; align-items: center; }
.nav-links a { color: var(--text-primary); text-decoration: none; font-size: 0.95rem; font-weight: 500; }
.nav-links a:hover { color: var(--primary); }
.admin-link { color: var(--warning) !important; }
.logout-link { color: var(--danger) !important; }

.container { max-width: 1200px; margin: 0 auto; padding: 30px 20px; }

h1 { font-size: 1.6rem; font-weight: 500; margin-bottom: 20px; }
h2 { font-size: 1.1rem; font-weight: 500; margin-bottom: 15px; color: var(--text-primary); }

/* Карточки */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Формы */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 0.9rem; }
input[type="text"], input[type="password"], input[type="number"], input[type="email"], input[type="tel"], select {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 4px;
    font-size: 0.95rem; font-family: inherit; outline: none; transition: border-color 0.2s;
}
input:focus, select:focus { border-color: var(--primary); }

.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.inline-form input, .inline-form select { width: auto; min-width: 120px; }

/* Кнопки */
button, .btn-primary, .btn-secondary, .btn-small {
    padding: 9px 18px; border: none; border-radius: 4px; font-size: 0.9rem;
    font-weight: 500; cursor: pointer; font-family: inherit; transition: background 0.2s;
    text-decoration: none; display: inline-block;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #757575; color: white; }
.btn-secondary:hover { background: #616161; }
.btn-small { padding: 5px 10px; font-size: 0.8rem; background: var(--primary); color: white; }
.btn-warning { background: var(--warning) !important; }
.btn-danger { background: var(--danger) !important; }

.admin-actions { display: flex; gap: 12px; margin-top: 20px; }

/* Таблицы */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th { background: #fafafa; padding: 12px; text-align: left; font-weight: 500; border-bottom: 2px solid var(--border); }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:hover { background: #fafafa; }
.row-inactive { opacity: 0.6; }
.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.inline-edit { display: flex; gap: 6px; align-items: center; }
.inline-edit input, .inline-edit select { width: auto !important; padding: 5px 8px; font-size: 0.85rem; }

/* Бейджи */
.badge { display: inline-block; padding: 3px 10px; border-radius: 3px; font-size: 0.8rem; font-weight: 500; }
.badge-admin { background: #ffe0b2; color: var(--warning); }
.badge-user { background: #e3f2fd; color: var(--primary); }
.badge-active { background: #c8e6c9; color: var(--success); }
.badge-inactive { background: #ffcdd2; color: var(--danger); }
.badge-success { background: #c8e6c9; color: var(--success); }
.badge-error { background: #ffcdd2; color: var(--danger); }
.badge-tnved { background: #e3f2fd; color: var(--primary); }
.badge-marking { background: #f3e5f5; color: #7b1fa2; }

/* Статистика */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 15px; margin-bottom: 25px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 4px; padding: 20px; text-align: center; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 0.85rem; color: var(--text-secondary); margin-top: 5px; }

/* Профиль */
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.info-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.info-label { color: var(--text-secondary); font-weight: 500; }

.balance-display { text-align: center; padding: 10px 0; }
.balance-main { margin-bottom: 15px; }
.balance-remaining { font-size: 3rem; font-weight: 700; color: var(--success); }
.balance-of { display: block; font-size: 1rem; color: var(--text-secondary); }
.balance-bar { background: #e0e0e0; height: 10px; border-radius: 5px; overflow: hidden; margin: 15px 0; }
.balance-bar-fill { background: var(--primary); height: 100%; transition: width 0.3s; }
.balance-details { display: flex; justify-content: space-around; font-size: 0.9rem; color: var(--text-secondary); }

/* Flash-сообщения */
.flash-messages { margin-bottom: 20px; }
.flash { padding: 12px 16px; border-radius: 4px; margin-bottom: 10px; font-size: 0.95rem; }
.flash-success { background: #e8f5e9; color: var(--success); border: 1px solid #a5d6a7; }
.flash-error { background: #ffebee; color: var(--danger); border: 1px solid #ef9a9a; }

/* Страница логина */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%); }
.login-card { background: white; padding: 40px; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,0.2); width: 100%; max-width: 400px; }
.login-card h1 { text-align: center; color: var(--primary); margin-bottom: 5px; }
.login-card .subtitle { text-align: center; color: var(--text-secondary); margin-bottom: 25px; font-size: 0.9rem; }
.login-card button { width: 100%; padding: 12px; font-size: 1rem; margin-top: 10px; }

@media (max-width: 768px) {
    .profile-grid { grid-template-columns: 1fr; }
    .top-nav { flex-direction: column; gap: 10px; }
    .nav-links { flex-wrap: wrap; justify-content: center; }
    .inline-form { flex-direction: column; }
    .inline-form input, .inline-form select { width: 100%; }
}
