/*
 * ============================================================================
 * INDIAN RAILWAY MCC REPORTING SYSTEM - ADMIN THEME CSS
 * ============================================================================
 * Professional, responsive, and consistent theme for admin panel
 * Color Scheme: #343a40 (header), #3c8dbc (primary/accent)
 * ============================================================================
 */

:root {
  --color-primary: #3c8dbc;
  --color-primary-dark: #2c6a89;
  --color-primary-light: #5a9fcf;
  --color-header: #343a40;
  --color-header-light: #454d55;
  --color-border: #ddd;
  --color-border-dark: #999;
  --color-bg-light: #f8f9fa;
  --color-bg-alt: #f0f0f0;
  --color-text-primary: #000;
  --color-text-secondary: #333;
  --color-text-light: #666;
  --color-white: #ffffff;
}

* {
  box-sizing: border-box;
}

.admin-body {
    background-color: var(--color-bg-alt);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #334155;
}

.admin-main {
    font-size: 14px;
    font-weight: 400;
}

.admin-main h4,
.admin-main h5,
.admin-main h6,
.card-header,
.modal-title {
    font-weight: 600 !important;
    color: #1e293b;
}

.admin-main h4 {
    font-size: 18px;
}

.admin-main h5 {
    font-size: 16px;
}

.admin-main h6,
.card-header,
.modal-title {
    font-size: 14px;
}

.admin-main .fw-bold {
    font-weight: 600 !important;
}

.form-label,
.form-control,
.form-select,
.alert,
.modal-body {
    font-size: 13px;
}

.form-label {
    font-weight: 600;
}

.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 260px;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1030;
    transition: transform 0.3s ease;
    background-color: var(--color-header);
}

.admin-brand h5 {
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}

.admin-sidebar .nav-link {
    color: rgba(255,255,255,0.75);
    padding: 0.8rem 1.25rem;
    border-radius: 0 6px 6px 0;
    margin: 2px 8px;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(60,141,188,0.25) 0%, rgba(60,141,188,0.05) 100%);
    border-left: 3px solid var(--color-primary);
    padding-left: calc(1.25rem - 3px);
}

.admin-main {
    flex: 1;
    margin-left: 260px;
    padding: 1.5rem;
    transition: margin-left 0.3s ease;
}

.stat-card {
    background: var(--color-white);
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.25rem;
    border-left: 4px solid var(--color-primary);
    height: 100%;
    border: 1px solid var(--color-border);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    background: var(--color-primary);
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0;
    color: var(--color-text-primary);
}

.stat-card .stat-label {
    color: var(--color-text-light);
    font-size: 0.875rem;
    font-weight: 700;
}

/* Dashboard Stat Cards v2 */
.db-card {
    background: var(--color-white) !important;
    border-radius: 10px !important;
    box-shadow: none !important;
    padding: 8px 14px !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    height: 100% !important;
    border: 1px solid #bfbfbf !important;
}

.db-card .db-icon {
    width: 66px !important;
    height: 66px !important;
    min-width: 66px !important;
    min-height: 66px !important;
    border-radius: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 32px !important;
    color: #ffffff !important;
    margin-right: 18px !important;
    flex-shrink: 0 !important;
}

.db-card .db-body {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    text-align: center !important;
}

.db-card .db-title {
    font-size: 13px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    color: #111 !important;
    margin-bottom: 4px !important;
    letter-spacing: 0 !important;
    line-height: 1.2 !important;
}

.db-card .db-stats {
    display: flex !important;
    flex-direction: row !important;
    gap: 0 !important;
    justify-content: center !important;
    align-items: center !important;
}

.db-card .db-stats > div {
    min-width: 95px !important;
    text-align: center !important;
}

.db-card .db-stats > div + div {
    border-left: 1px solid #cfcfcf !important;
}

.db-card .db-stat-label {
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #333 !important;
    text-transform: uppercase !important;
    margin-bottom: 1px !important;
    line-height: 1.2 !important;
}

.db-card .db-stat-value {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #333 !important;
    line-height: 1.2 !important;
    margin: 0 !important;
}

.db-card .db-stat-single {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #333 !important;
    line-height: 1.2 !important;
    margin: 0 !important;
}

.chart-card {
    background: var(--color-white);
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.25rem;
    border: 1px solid var(--color-border);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.performance-metrics {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    gap: 14px;
}

.sidebar-toggle {
    display: none !important;
}

.table-responsive {
    background: var(--color-white);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }
    .admin-sidebar.show {
        transform: translateX(0);
    }
    .admin-main {
        margin-left: 0;
        padding: 1rem;
    }
    .sidebar-toggle {
        display: inline-flex !important;
    }
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1025;
}
.sidebar-overlay.show {
    display: block;
}

/* Mobile pagination */
.pagination {
    flex-wrap: wrap;
    gap: 0.25rem;
}
.pagination .page-item {
    margin: 0;
}

/* Mobile table improvements */
.table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* Mobile modals */
@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 0.5rem;
    }
    .modal-dialog.modal-lg {
        max-width: 100%;
        margin: 0.5rem;
    }
}

/* Mobile filter buttons */
.filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.filter-buttons .ms-auto {
    margin-left: 0 !important;
}
@media (min-width: 768px) {
    .filter-buttons .ms-auto {
        margin-left: auto !important;
    }
}

/* Mobile db-card adjustments */
@media (max-width: 575.98px) {
    .db-card {
        padding: 12px !important;
    }
    .db-card .db-icon {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        font-size: 18px !important;
        margin-right: 12px !important;
    }
    .db-card .db-stat-value {
        font-size: 18px !important;
    }
    .db-card .db-stat-single {
        font-size: 22px !important;
    }
}

/* Touch-friendly tap targets */
.btn-sm {
    min-height: 36px;
    min-width: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Card padding on mobile */
@media (max-width: 767.98px) {
    .chart-card {
        padding: 1rem;
    }
}

/* Professional Cards */
.card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s ease;
    overflow: hidden;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.card-header {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.card-header.bg-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%) !important;
    border-bottom: none;
    color: #fff;
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table thead th {
    background: #f8fafc;
    border-top: none;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #475569;
    padding: 0.875rem 1rem;
    border-bottom: 2px solid #e2e8f0;
}

.table tbody td {
    padding: 0.875rem 1rem;
    color: #334155;
    font-size: 13px;
    vertical-align: middle;
}

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

/* Badges */
.badge {
    padding: 0.4em 0.75em;
    font-weight: 600;
    font-size: 12px;
    border-radius: 6px;
}

/* Buttons */
.btn {
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border: none;
    box-shadow: 0 2px 6px rgba(60,141,188,0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, #245673 100%);
    box-shadow: 0 4px 12px rgba(60,141,188,0.4);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #27ae60 0%, #219150 100%);
    border: none;
    box-shadow: 0 2px 6px rgba(39,174,96,0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, #219150 0%, #1b7a43 100%);
    box-shadow: 0 4px 12px rgba(39,174,96,0.4);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border: none;
    box-shadow: 0 2px 6px rgba(231,76,60,0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    box-shadow: 0 4px 12px rgba(231,76,60,0.4);
    transform: translateY(-1px);
}

.btn-outline-primary {
    border: 1.5px solid var(--color-primary);
    color: var(--color-primary);
}

.btn-outline-primary:hover {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border-color: var(--color-primary);
}

/* Forms */
.form-control, .form-select {
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.6rem 0.875rem;
    font-size: 13px;
    transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(60,141,188,0.12);
}

.form-label {
    font-weight: 600;
    font-size: 13px;
    color: #475569;
    margin-bottom: 0.375rem;
}

/* Modals */
.modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-header {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e2e8f0;
    border-radius: 12px 12px 0 0;
    padding: 1rem 1.5rem;
}

.modal-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text-secondary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #e2e8f0;
    padding: 1rem 1.5rem;
}

/* Alerts */
.alert {
    border: none;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    font-weight: 400;
    font-size: 13px;
    display: flex;
    align-items: center;
}

.alert-danger {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #991b1b;
}

.alert-success {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    color: #166534;
}

.alert-info {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: #1e40af;
}

/* Pagination */
.page-link {
    border-radius: 6px;
    margin: 0 2px;
    border: 1.5px solid #e2e8f0;
    color: var(--color-text-secondary);
    font-weight: 600;
    font-size: 13px;
    padding: 0.4rem 0.7rem;
    transition: all 0.2s ease;
}

.page-item.active .page-link {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border-color: var(--color-primary);
    box-shadow: 0 2px 6px rgba(60,141,188,0.3);
}

.page-link:hover {
    background: #f8fafc;
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.admin-report-page {
    font-size: 15px;
    font-weight: 500;
}

/* Override chart-card flex/height for report filter cards */
.admin-report-page .card.chart-card {
    display: block !important;
    height: auto !important;
    flex-direction: column !important;
}

.admin-report-page h4 {
    font-size: 20px;
    font-weight: 700 !important;
}

.admin-report-page .table thead th {
    font-size: 14px;
    font-weight: 700;
}

.admin-report-page .table tbody td {
    font-size: 14px;
    font-weight: 500;
}

.admin-report-page .form-label,
.admin-report-page .form-control,
.admin-report-page .form-select,
.admin-report-page .btn,
.admin-report-page .page-link {
    font-size: 14px;
    font-weight: 600;
}

.admin-report-page .badge {
    font-size: 13px;
    font-weight: 700;
}

.admin-report-page .modal-body,
.admin-report-page .modal-body td,
.admin-report-page .modal-body th,
.admin-report-page .modal-body p,
.admin-report-page .modal-body small {
    font-size: 14px;
    font-weight: 500;
}

/* Stations table */
.stations-table {
    table-layout: fixed;
    width: 100%;
}

.stations-table thead th {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 12px 14px;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.stations-table tbody td {
    font-size: 14px;
    padding: 12px 14px;
    vertical-align: middle;
}

.stations-table th:nth-child(1),
.stations-table td:nth-child(1) { width: 22%; }
.stations-table th:nth-child(2),
.stations-table td:nth-child(2) { width: 14%; text-align: center; }
.stations-table th:nth-child(3),
.stations-table td:nth-child(3) { width: 16%; text-align: center; }
.stations-table th:nth-child(4),
.stations-table td:nth-child(4) { width: 36%; }
.stations-table th:nth-child(5),
.stations-table td:nth-child(5) { width: 12%; text-align: center; }

/* Progress bars */
.progress {
    border-radius: 8px;
    background-color: #e2e8f0;
    height: 14px !important;
}

.progress-bar {
    border-radius: 8px;
}

/* Chart cards improvements */
.chart-card {
    background: var(--color-white);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    padding: 1.25rem;
    border: 1px solid #e2e8f0;
    transition: box-shadow 0.2s ease;
}

.chart-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Dropdowns */
.dropdown-menu {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    padding: 0.5rem;
}

.dropdown-item {
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 13px;
    font-weight: 400;
    transition: all 0.15s ease;
}

.dropdown-item:hover {
    background: rgba(60,141,188,0.08);
    color: var(--color-primary);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Login page */
.login-page {
    background: radial-gradient(circle at top left, rgba(60,141,188,0.35), transparent 35%),
                linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-shell {
    width: 100%;
    max-width: 920px;
}

.login-card-pro {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #ffffff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,0.28);
}

.login-brand-panel {
    background: linear-gradient(135deg, #3c8dbc 0%, #1e5f82 100%);
    color: #ffffff;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.login-brand-panel::after {
    content: "";
    position: absolute;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    right: -80px;
    bottom: -80px;
}

.login-brand-icon {
    width: 74px;
    height: 74px;
    border-radius: 18px;
    background: rgba(255,255,255,0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 1.25rem;
    border: 1px solid rgba(255,255,255,0.22);
}

.login-brand-panel h3 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-brand-panel p {
    color: rgba(255,255,255,0.86);
    margin-bottom: 2rem;
}

.login-feature-list {
    display: grid;
    gap: 0.85rem;
    position: relative;
    z-index: 1;
}

.login-feature-list div {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.92);
}

.login-form-panel {
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-form-header {
    margin-bottom: 1.5rem;
}

.login-kicker {
    display: inline-flex;
    color: var(--color-primary);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.5rem;
}

.login-form-header h4 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.35rem;
}

.login-form-header p {
    color: #64748b;
    margin-bottom: 0;
    font-size: 0.9rem;
}

.login-input-group {
    position: relative;
}

.login-input-group i {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-primary);
    z-index: 2;
}

.login-input-group .form-control {
    padding-left: 2.5rem;
    height: 44px;
}

.login-submit {
    height: 46px;
}

.login-footer-info {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.login-footer-info p {
    font-size: 0.78rem;
    color: #64748b;
    margin-bottom: 0.25rem;
}

@media (max-width: 767.98px) {
    .login-card-pro {
        grid-template-columns: 1fr;
    }
    .login-brand-panel {
        padding: 2rem;
    }
    .login-form-panel {
        padding: 2rem;
    }
}

/* QR code section in sidebar */
.admin-sidebar .p-3.text-center img {
    transition: transform 0.2s ease;
}

.admin-sidebar .p-3.text-center img:hover {
    transform: scale(1.03);
}

.station-qr-thumb {
    width: 76px;
    height: 76px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #fff;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
