/**
 * Стили панели администратора АИС «Таможенный контроль»
 */

:root {
    --primary: #1e3a5f;
    --primary-dark: #14263e;
    --primary-light: #2a4e7c;
    --accent: #2980b9;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #3498db;
    --bg-page: #f0f2f5;
    --bg-card: #ffffff;
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --border-color: #dce1e6;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

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

/* ========================================================
   СТРАНИЦА ВХОДА (LOGIN)
   ======================================================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #14263e 0%, #1e3a5f 50%, #2a4e7c 100%);
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    width: 100%;
    max-width: 420px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: fadeIn 0.3s ease;
}

.login-header {
    background: #14263e;
    color: white;
    padding: 30px 20px;
    text-align: center;
    border-bottom: 3px solid #f39c12;
}

.login-header .emblem-icon {
    font-size: 42px;
    color: #f39c12;
    margin-bottom: 10px;
}

.login-header h2 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.login-header p {
    font-size: 12px;
    color: #a0aec0;
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.login-body {
    padding: 30px 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.form-group label .required {
    color: var(--danger);
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon i {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 16px;
}

.input-with-icon input,
.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-main);
    background: #fff;
    transition: all 0.2s ease;
}

.input-with-icon input {
    padding-left: 42px;
}

.form-control:focus,
.input-with-icon input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.15);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-dark);
}

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

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

.btn-warning {
    background: var(--warning);
    color: white;
}
.btn-warning:hover {
    background: #d68910;
}

.btn-secondary {
    background: #e2e8f0;
    color: var(--text-main);
}
.btn-secondary:hover {
    background: #cbd5e1;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
}

.login-back-link {
    display: block;
    text-align: center;
    margin-top: 15px;
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
}
.login-back-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* ========================================================
   ОСНОВНОЙ МАКЕТ АДМИНКИ (LAYOUT)
   ======================================================== */
.admin-navbar {
    background: var(--primary-dark);
    color: white;
    padding: 0 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    border-bottom: 3px solid #f39c12;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    text-decoration: none;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.5px;
}

.nav-brand i {
    color: #f39c12;
    font-size: 22px;
}

.nav-badge {
    background: rgba(255, 255, 255, 0.15);
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.nav-tools {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-time {
    font-size: 13px;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 6px;
}

.admin-layout {
    display: flex;
    flex: 1;
}

/* Боковая панель */
.admin-sidebar {
    width: 250px;
    background: #1e2a3a;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-menu {
    list-style: none;
    padding: 15px 0;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 22px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 4px solid transparent;
}

.sidebar-menu li a i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.sidebar-menu li a:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-menu li.active a {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border-left-color: #f39c12;
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 12px;
    color: #64748b;
}

/* Контентная часть */
.admin-main {
    flex: 1;
    padding: 25px 30px;
    overflow-y: auto;
}

.page-title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
}

.page-title-bar h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Статистические карточки */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card.blue { border-left-color: var(--info); }
.stat-card.orange { border-left-color: var(--warning); }
.stat-card.green { border-left-color: var(--success); }
.stat-card.red { border-left-color: var(--danger); }

.stat-info h3 {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

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

.stat-icon {
    font-size: 32px;
    opacity: 0.2;
}
.stat-card.blue .stat-icon { color: var(--info); opacity: 0.3; }
.stat-card.orange .stat-icon { color: var(--warning); opacity: 0.3; }
.stat-card.green .stat-icon { color: var(--success); opacity: 0.3; }
.stat-card.red .stat-icon { color: var(--danger); opacity: 0.3; }

/* Карточка контента */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fafbfc;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.card-header h2,
.card-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 20px;
}

/* Панель фильтров и поиска */
.toolbar-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 250px;
    max-width: 400px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 9px 12px 9px 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.filter-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Таблица ТС */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.custom-table th {
    background: #f1f4f8;
    color: var(--primary);
    font-weight: 600;
    text-align: left;
    padding: 12px 14px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.custom-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #edf2f7;
    vertical-align: middle;
}

.custom-table tbody tr:hover {
    background: #f8fafc;
}

.vin-code {
    font-family: monospace;
    font-weight: 700;
    color: var(--primary);
    font-size: 14px;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.photo-thumb {
    width: 44px;
    height: 32px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.2s;
}
.photo-thumb:hover {
    transform: scale(1.15);
}

.no-photo-badge {
    display: inline-block;
    padding: 3px 6px;
    background: #e2e8f0;
    color: #64748b;
    border-radius: 3px;
    font-size: 11px;
}

/* Бейджи статусов */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.status-pill.status-green { background: #e8f8f0; color: #27ae60; border: 1px solid #a3e9c4; }
.status-pill.status-orange { background: #fef5e7; color: #d68910; border: 1px solid #fad7a0; }
.status-pill.status-red { background: #fdeeed; color: #c0392b; border: 1px solid #f5b7b1; }
.status-pill.status-blue { background: #ebf5fb; color: #2980b9; border: 1px solid #aed6f1; }

/* Кнопки действий в таблице */
.actions-cell {
    display: flex;
    gap: 6px;
}

.action-btn {
    background: white;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 32px;
    height: 32px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 13px;
}

.action-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: #f0f7fb;
}

.action-btn.btn-delete:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: #fdf2f2;
}

.action-btn.btn-status:hover {
    border-color: var(--warning);
    color: var(--warning);
    background: #fffbf0;
}

/* ========================================================
   ФОРМЫ ДОБАВЛЕНИЯ И РЕДАКТИРОВАНИЯ
   ======================================================== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.form-grid.two-cols {
    grid-template-columns: 1fr 1fr;
}

.photo-uploader-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    background: #fafbfc;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.photo-uploader-area:hover,
.photo-uploader-area.dragover {
    border-color: var(--accent);
    background: #f0f7fb;
}

.uploader-preview {
    margin-top: 15px;
    position: relative;
    display: inline-block;
}

.uploader-preview img {
    max-height: 180px;
    max-width: 100%;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.remove-photo-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* ========================================================
   МОДАЛЬНЫЕ ОКНА
   ======================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.25s ease;
    overflow: hidden;
}

.modal-content.modal-lg {
    max-width: 850px;
}

.modal-header {
    padding: 16px 22px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}
.modal-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 22px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 14px 22px;
    background: #f8fafc;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

/* Список статусов внутри модалки */
.status-timeline {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.timeline-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: #f8fafc;
    border: 1px solid var(--border-color);
}

.timeline-item .status-text {
    font-weight: 500;
    font-size: 13px;
    flex: 1;
}

.timeline-item .status-date {
    font-size: 12px;
    color: var(--text-muted);
    margin-right: 15px;
}

/* Toast сообщения */
.toast-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
    min-width: 280px;
    border-left: 4px solid var(--primary);
    animation: toastIn 0.3s ease;
}

.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes toastIn {
    from { transform: translateX(50px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Адаптивность для мобильных */
@media (max-width: 900px) {
    .admin-layout {
        flex-direction: column;
    }
    .admin-sidebar {
        width: 100%;
    }
    .sidebar-menu {
        display: flex;
        overflow-x: auto;
        padding: 5px;
    }
    .sidebar-menu li a {
        padding: 8px 14px;
        white-space: nowrap;
        border-left: none;
        border-bottom: 3px solid transparent;
    }
    .sidebar-menu li.active a {
        border-left: none;
        border-bottom-color: #f39c12;
    }
    .form-grid.two-cols {
        grid-template-columns: 1fr;
    }
    .admin-main {
        padding: 15px;
    }
}
