/* ==========================================================
   БАЗОВЫЕ СТИЛИ
   ========================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: #f4f7fc; color: #1e293b; }

/* ==========================================================
   СТРАНИЦА ВХОДА (index.php)
   ========================================================== */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1e3a8a, #3b82f6); }
.login-container { background: #fff; padding: 40px; border-radius: 16px; box-shadow: 0 20px 40px rgba(0,0,0,0.2); width: 100%; max-width: 400px; text-align: center; }
.login-container h1 { margin-bottom: 8px; font-size: 28px; }
.login-container p { color: #64748b; margin-bottom: 24px; }
.login-container input { width: 100%; padding: 12px 16px; margin-bottom: 12px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 16px; outline: none; transition: border 0.2s; }
.login-container input:focus { border-color: #3b82f6; }
.login-container button { width: 100%; padding: 12px; background: #2563eb; color: #fff; border: none; border-radius: 8px; font-size: 16px; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.login-container button:hover { background: #1d4ed8; }
.error { background: #fee2e2; color: #b91c1c; padding: 10px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }

/* ==========================================================
   ДАШБОРД И САЙДБАР (dashboard.php)
   ========================================================== */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 280px; background: #0f172a; color: #e2e8f0; display: flex; flex-direction: column; padding: 24px 0; flex-shrink: 0; }
.sidebar-header { padding: 0 24px 20px; border-bottom: 1px solid #1e293b; margin-bottom: 16px; }
.sidebar-header h2 { font-size: 22px; font-weight: 700; letter-spacing: 1px; color: #fff; }
.user { font-size: 13px; color: #94a3b8; display: block; margin-top: 4px; }
.sidebar nav { flex: 1; padding: 0 12px; overflow-y: auto; }

/* Выпадающее меню */
.nav-group { margin-bottom: 8px; }
.nav-group summary { padding: 10px 12px; font-weight: 600; font-size: 14px; color: #94a3b8; cursor: pointer; user-select: none; list-style: none; display: flex; justify-content: space-between; align-items: center; border-radius: 8px; transition: background 0.2s, color 0.2s; }
.nav-group summary:hover { background: #1e293b; color: #f1f5f9; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after { content: ''; border: solid #94a3b8; border-width: 0 2px 2px 0; display: inline-block; padding: 3px; transform: rotate(45deg); transition: transform 0.2s; margin-right: 4px; }
.nav-group[open] summary::after { transform: rotate(-135deg); margin-bottom: 4px; }
.nav-items { display: flex; flex-direction: column; margin-top: 4px; }

/* Кнопки меню */
.nav-btn { display: flex; align-items: center; width: 100%; padding: 10px 12px; background: none; border: none; color: #cbd5e1; text-align: left; font-size: 14px; font-weight: 500; cursor: pointer; border-radius: 8px; transition: all 0.2s; margin-bottom: 2px; }
.nav-btn:hover { background: #1e293b; color: #f1f5f9; }
.nav-btn.active { background: #2563eb; color: #fff; }
.nav-icon { width: 18px; height: 18px; margin-right: 12px; flex-shrink: 0; opacity: 0.8; }
.nav-btn.active .nav-icon { opacity: 1; }

/* Кнопка выхода */
.logout-btn { display: flex; align-items: center; margin: 20px 24px 0; padding: 12px; background: #ef4444; color: #fff; text-decoration: none; border-radius: 8px; font-weight: 600; font-size: 14px; transition: background 0.2s; }
.logout-btn:hover { background: #dc2626; }
.logout-btn .nav-icon { margin-right: 10px; }

/* Основная область */
.content { flex: 1; padding: 32px; overflow-y: auto; }
.content-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid #e2e8f0; }
.content-header h1 { font-size: 24px; font-weight: 700; color: #0f172a; }
.refresh-info { font-size: 13px; color: #64748b; }
.loading { text-align: center; padding: 40px; color: #64748b; font-size: 16px; }
.hidden { display: none !important; }
.error-box { background: #fee2e2; color: #b91c1c; padding: 16px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; }

/* ==========================================================
   БЛОКИ СТАТИСТИКИ (Главная страница)
   ========================================================== */
.location-group { margin-bottom: 40px; }
.location-title { font-size: 18px; font-weight: 700; color: #1e293b; margin-bottom: 16px; display: flex; align-items: center; }
.location-title::after { content: ''; flex: 1; height: 1px; background: #e2e8f0; margin-left: 16px; }

.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }

/* Карточки */
.summary-card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); border: 1px solid #e2e8f0; display: flex; flex-direction: column; justify-content: center; }
.large-card { padding: 30px 24px; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s; }
.large-card:hover { transform: translateY(-4px); box-shadow: 0 12px 24px rgba(0,0,0,0.08); }
.large-card .card-value { font-size: 48px; font-weight: 800; margin-top: 8px; }
.small-card { padding: 16px 20px; }
.small-card .card-value { font-size: 26px; font-weight: 700; }

/* Цветовые акценты карточек */
.card-empty { border-top: 4px solid #3b82f6; }
.card-empty .card-value { color: #3b82f6; }
.card-loaded { border-top: 4px solid #f59e0b; }
.card-loaded .card-value { color: #f59e0b; }
.card-requests { border-top: 4px solid #8b5cf6; }
.card-requests .card-value { color: #8b5cf6; }
.card-cargo { border-top: 4px solid #10b981; }
.card-cargo .card-value { color: #10b981; }
.card-transit { border-top: 4px solid #06b6d4; }
.card-transit .card-value { color: #06b6d4; }
.card-label { font-size: 12px; color: #64748b; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

/* ==========================================================
   СПИСОК ЗАЯВОК
   ========================================================== */
.requests-list { display: flex; flex-direction: column; gap: 16px; }
.request-card { background: #fff; border-radius: 12px; border: 1px solid #e2e8f0; box-shadow: 0 2px 8px rgba(0,0,0,0.03); padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.request-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #f1f5f9; padding-bottom: 12px; }
.request-id { font-size: 16px; font-weight: 700; color: #0f172a; }
.request-category { font-size: 12px; font-weight: 600; background: #f1f5f9; color: #475569; padding: 4px 10px; border-radius: 6px; text-transform: uppercase; letter-spacing: 0.5px; }

.request-body { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.request-info { font-size: 14px; color: #334155; }
.request-info span { color: #64748b; font-weight: 500; }

.request-footer { margin-top: 4px; }
.status-badge { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.status-badge svg { width: 16px; height: 16px; }

/* Цвета статусов */
.status-transit { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.status-warehouse { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.status-completed { background: #f8fafc; color: #64748b; border: 1px solid #e2e8f0; }

/* ==========================================================
   ТАБЛИЦЫ С ДАННЫМИ
   ========================================================== */
.table-container { background: #fff; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); border: 1px solid #e2e8f0; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
.data-table th { background: #f8fafc; color: #475569; font-weight: 600; padding: 14px 16px; border-bottom: 1px solid #e2e8f0; white-space: nowrap; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px;}
.data-table td { padding: 12px 16px; border-bottom: 1px solid #e2e8f0; color: #1e293b; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f1f5f9; }
.empty-msg { color: #64748b; font-style: italic; padding: 24px; text-align: center; }

/* ==========================================================
   КНОПКИ И МОДАЛЬНОЕ ОКНО (Формы добавления)
   ========================================================== */
.btn-primary {
    background: #2563eb; color: #fff; border: none; padding: 10px 20px;
    border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer;
    transition: background 0.2s;
}
.btn-primary:hover { background: #1d4ed8; }

/* Модалка */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.6); display: flex;
    align-items: center; justify-content: center; z-index: 1000;
}
.modal-content {
    background: #fff; border-radius: 12px; width: 100%; max-width: 500px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2); overflow: hidden;
    animation: modalFade 0.2s ease-out;
}
@keyframes modalFade { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid #e2e8f0; }
.modal-header h2 { font-size: 18px; color: #0f172a; margin: 0; }
.modal-close { background: none; border: none; font-size: 24px; color: #64748b; cursor: pointer; padding: 0; }
.modal-close:hover { color: #ef4444; }
#modal-body { padding: 24px; max-height: 70vh; overflow-y: auto; }

/* Формы */
.modal-form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; color: #475569; }
.form-group input {
    padding: 10px 14px; border: 1px solid #cbd5e1; border-radius: 8px;
    font-size: 14px; font-family: inherit; outline: none; transition: border 0.2s;
}
.form-group input:focus { border-color: #3b82f6; }
.btn-submit {
    margin-top: 10px; padding: 12px; background: #10b981; color: #fff;
    border: none; border-radius: 8px; font-size: 15px; font-weight: 600;
    cursor: pointer; transition: background 0.2s;
}
.btn-submit:hover { background: #059669; }