/* ===========================
   SENTRAFLOW RESPONSIVE OPTIMIZATION
   Comprehensive mobile and desktop optimization for all pages
   =========================== */

/* ===== BASE RESPONSIVE STYLES ===== */
:root {
    --primary-color: #1e3c72;
    --secondary-color: #2a5298;
    --accent-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --light-bg: #f8f9fc;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --card-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.12);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

/* ===== GLOBAL CONTAINER IMPROVEMENTS ===== */
.container-fluid {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

@media (max-width: 768px) {
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (max-width: 576px) {
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* ===== HEADER OPTIMIZATIONS ===== */
.top-user-bar {
    padding: 0.5rem 0;
}

.top-user-bar .container-fluid {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

@media (max-width: 768px) {
    .top-user-bar {
        padding: 0.75rem 0;
    }
    
    .top-user-bar .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .top-user-bar .col-md-6:first-child {
        text-align: center;
        margin-bottom: 0.5rem;
    }
    
    .top-user-bar .col-md-6:last-child {
        text-align: center !important;
    }
}

.main-header {
    padding: 1rem 0;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-logo {
    max-height: 60px;
    width: auto;
}

@media (max-width: 768px) {
    .main-header {
        padding: 0.75rem 0;
    }
    
    .header-logo {
        max-height: 50px;
    }
}

@media (max-width: 576px) {
    .header-logo {
        max-height: 45px;
    }
}

/* ===== NAVIGATION IMPROVEMENTS ===== */
.navbar {
    padding: 0.75rem 0;
}

.navbar-nav .nav-link {
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    margin: 0 0.25rem;
    transition: var(--transition);
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

@media (max-width: 992px) {
    .navbar-nav {
        padding: 1rem 0;
    }
    
    .navbar-nav .nav-link {
        padding: 1rem 1.5rem;
        margin: 0.25rem 0;
        border-radius: 10px;
    }
}

/* ===== CARD OPTIMIZATIONS ===== */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    margin-bottom: 1.5rem;
}

.card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
}

.card-body {
    padding: 2rem;
}

@media (max-width: 768px) {
    .card {
        margin-bottom: 1.25rem;
    }
    
    .card-body {
        padding: 1.5rem;
    }
}

@media (max-width: 576px) {
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1.25rem;
    }
}

/* ===== METRIC CARDS ===== */
.metric-card {
    height: 100%;
    transition: var(--transition);
}

.metric-card .card-body {
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    min-height: 220px;
}

.metric-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto 1rem;
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.metric-label {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.metric-description {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: auto;
    padding-top: 0.75rem;
    line-height: 1.4;
}

@media (max-width: 768px) {
    .metric-card .card-body {
        padding: 2rem 1.5rem;
        min-height: 200px;
    }
    
    .metric-icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .metric-value {
        font-size: 2rem;
        margin-bottom: 0.75rem;
    }
    
    .metric-label {
        font-size: 0.9rem;
        margin-bottom: 0.75rem;
    }
    
    .metric-description {
        padding-top: 0.75rem;
        margin-top: auto;
    }
}

@media (max-width: 576px) {
    .metric-card .card-body {
        padding: 1.75rem 1.25rem;
        min-height: 180px;
    }
    
    .metric-icon {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }
    
    .metric-value {
        font-size: 1.75rem;
        margin-bottom: 0.75rem;
    }
    
    .metric-label {
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
    }
    
    .metric-description {
        padding-top: 0.5rem;
        margin-top: auto;
        font-size: 0.8rem;
    }
}

/* ===== BUTTON OPTIMIZATIONS ===== */
.btn {
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: var(--transition);
    border: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.9rem;
    }
    
    .btn-lg {
        padding: 0.875rem 1.75rem;
        font-size: 1rem;
    }
    
    .btn-sm {
        padding: 0.4rem 0.875rem;
        font-size: 0.85rem;
    }
}

/* ===== TABLE OPTIMIZATIONS ===== */
.table-responsive {
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    margin-bottom: 1.5rem;
}

.table {
    margin-bottom: 0;
}

.table th {
    background: var(--light-bg);
    border-top: none;
    padding: 1.25rem 1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.table td {
    padding: 1rem;
    vertical-align: middle;
}

@media (max-width: 768px) {
    .table th,
    .table td {
        padding: 0.875rem 0.75rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }
}

/* ===== FORM OPTIMIZATIONS ===== */
.form-control,
.form-select {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    padding: 0.75rem 1rem;
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(30, 60, 114, 0.25);
}

.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.75rem;
}

@media (max-width: 768px) {
    .form-control,
    .form-select {
        padding: 0.625rem 0.875rem;
        font-size: 0.9rem;
    }
    
    .form-label {
        font-size: 0.9rem;
    }
}

/* ===== SPACING OPTIMIZATIONS ===== */
.py-4 {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
}

.py-5 {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
}

.mb-4 {
    margin-bottom: 2rem !important;
}

.mb-5 {
    margin-bottom: 3rem !important;
}

@media (max-width: 768px) {
    .py-4 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
    
    .py-5 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    .mb-4 {
        margin-bottom: 1.5rem !important;
    }
    
    .mb-5 {
        margin-bottom: 2rem !important;
    }
}

@media (max-width: 576px) {
    .py-4 {
        padding-top: 1.25rem !important;
        padding-bottom: 1.25rem !important;
    }
    
    .py-5 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
    
    .mb-4 {
        margin-bottom: 1.25rem !important;
    }
    
    .mb-5 {
        margin-bottom: 1.5rem !important;
    }
}

/* ===== HERO SECTIONS ===== */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 3rem 0;
    margin-bottom: 2rem;
    border-radius: var(--border-radius);
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" fill="white" opacity="0.05"><polygon points="0,0 1000,0 1000,50 0,100"/></svg>');
    background-size: cover;
}

.hero-content {
    position: relative;
    z-index: 2;
}

@media (max-width: 768px) {
    .hero-section {
        padding: 2rem 0;
        margin-bottom: 1.5rem;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .hero-section .lead {
        font-size: 1rem;
    }
}

@media (max-width: 576px) {
    .hero-section {
        padding: 1.5rem 0;
        margin-bottom: 1rem;
    }
    
    .hero-section h1 {
        font-size: 1.75rem;
    }
    
    .hero-section .lead {
        font-size: 0.95rem;
    }
}

/* ===== DASHBOARD GRID ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 576px) {
    .dashboard-grid {
        gap: 1rem;
        margin-bottom: 1rem;
    }
}

/* ===== CHART CONTAINERS ===== */
.chart-container {
    position: relative;
    height: 400px;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .chart-container {
        height: 300px;
        margin-bottom: 1.25rem;
    }
}

@media (max-width: 576px) {
    .chart-container {
        height: 250px;
        margin-bottom: 1rem;
    }
}

/* ===== MAP CONTAINERS ===== */
.map-container {
    height: 500px;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .map-container {
        height: 400px;
        margin-bottom: 1.25rem;
    }
}

@media (max-width: 576px) {
    .map-container {
        height: 300px;
        margin-bottom: 1rem;
    }
}

/* ===== ALERT OPTIMIZATIONS ===== */
.alert {
    border: none;
    border-radius: var(--border-radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--card-shadow);
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .alert {
        padding: 1rem 1.25rem;
        margin-bottom: 1.25rem;
    }
}

@media (max-width: 576px) {
    .alert {
        padding: 0.875rem 1rem;
        margin-bottom: 1rem;
    }
}

/* ===== BADGE OPTIMIZATIONS ===== */
.badge {
    padding: 0.5rem 0.75rem;
    border-radius: 20px;
    font-weight: 500;
}

@media (max-width: 768px) {
    .badge {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }
}

/* ===== DROPDOWN OPTIMIZATIONS ===== */
.dropdown-menu {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    padding: 0.75rem 0;
}

.dropdown-item {
    padding: 0.75rem 1.5rem;
    transition: var(--transition);
}

.dropdown-item:hover {
    background: var(--light-bg);
    transform: translateX(5px);
}

/* ===== BREADCRUMB OPTIMIZATIONS ===== */
.breadcrumb {
    background: var(--light-bg);
    border-radius: var(--border-radius);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .breadcrumb {
        padding: 0.875rem 1.25rem;
        margin-bottom: 1.25rem;
    }
}

@media (max-width: 576px) {
    .breadcrumb {
        padding: 0.75rem 1rem;
        margin-bottom: 1rem;
        font-size: 0.9rem;
    }
}

/* ===== PAGINATION OPTIMIZATIONS ===== */
.pagination {
    justify-content: center;
    margin-bottom: 2rem;
}

.page-link {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    margin: 0 0.25rem;
    padding: 0.75rem 1rem;
    transition: var(--transition);
}

.page-link:hover {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .page-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
}

/* ===== MODAL OPTIMIZATIONS ===== */
.modal-content {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
    padding: 1.5rem 2rem 1rem;
}

.modal-body {
    padding: 1.5rem 2rem;
}

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

@media (max-width: 768px) {
    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (max-width: 576px) {
    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* ===== TEXT OPTIMIZATIONS ===== */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    margin-bottom: 1rem;
}

.lead {
    font-size: 1.2rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.25rem; }
    
    .lead {
        font-size: 1.1rem;
        margin-bottom: 1.25rem;
    }
}

@media (max-width: 576px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }
    
    .lead {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
}

/* ===== FOOTER OPTIMIZATIONS ===== */
.footer {
    background: var(--primary-color);
    color: white;
    padding: 2rem 0 1rem;
    margin-top: auto;
}

.footer .container-fluid {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

@media (max-width: 768px) {
    .footer {
        padding: 1.5rem 0 0.75rem;
    }
    
    .footer .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* ===== LOADING STATES ===== */
.loading-spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 0.25em solid rgba(0, 0, 0, 0.1);
    border-top: 0.25em solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== UTILITY CLASSES ===== */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.shadow-soft {
    box-shadow: var(--card-shadow) !important;
}

.shadow-soft-hover:hover {
    box-shadow: var(--card-shadow-hover) !important;
}

.border-radius {
    border-radius: var(--border-radius) !important;
}

.transition {
    transition: var(--transition) !important;
}

/* ===== SCROLL OPTIMIZATIONS ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.focus-visible:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ===== PRINT STYLES ===== */
@media print {
    .navbar,
    .footer,
    .btn,
    .dropdown,
    .modal {
        display: none !important;
    }
    
    .container-fluid {
        padding: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}