/* Professional Banking Theme - Loan Prep Intelligence Studio */

:root {
    /* Primary Banking Colors */
    --primary-dark: #1a365d;      /* Deep Navy Blue */
    --primary: #2c5282;           /* Royal Blue */
    --primary-light: #3182ce;     /* Bright Blue */
    
    /* Accent Colors */
    --accent-gold: #d69e2e;       /* Professional Gold */
    --accent-gold-light: #ecc94b;
    
    /* Status Colors */
    --success: #276749;           /* Deep Green */
    --success-light: #48bb78;
    --warning: #c05621;           /* Deep Orange */
    --warning-light: #ed8936;
    --danger: #c53030;            /* Deep Red */
    --danger-light: #fc8181;
    --info: #2b6cb0;              /* Info Blue */
    
    /* Neutral Colors */
    --gray-50: #f7fafc;
    --gray-100: #edf2f7;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e0;
    --gray-400: #a0aec0;
    --gray-500: #718096;
    --gray-600: #4a5568;
    --gray-700: #2d3748;
    --gray-800: #1a202c;
    --gray-900: #171923;
    
    /* Backgrounds */
    --bg-body: #f0f4f8;
    --bg-card: #ffffff;
    --bg-sidebar: var(--primary-dark);
    
    /* Text Colors */
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --text-light: #a0aec0;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 200ms ease;
    --transition-slow: 300ms ease;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--gray-800);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

/* ==================== NAVBAR ==================== */
.navbar {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%) !important;
    box-shadow: var(--shadow-md);
    padding: 0.75rem 1rem;
    border-bottom: 3px solid var(--accent-gold);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.35rem;
    color: #ffffff !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand i {
    color: var(--accent-gold);
    font-size: 1.5rem;
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.85) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: var(--radius);
    transition: var(--transition);
    margin: 0 0.25rem;
}

.navbar-nav .nav-link:hover {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.1);
}

.navbar-nav .nav-link.active {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.15);
}

.navbar .dropdown-menu {
    border: none;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
    padding: 0.5rem;
}

.navbar .dropdown-item {
    border-radius: var(--radius);
    padding: 0.5rem 1rem;
    font-weight: 500;
}

.navbar .dropdown-item:hover {
    background-color: var(--gray-100);
}

/* ==================== CARDS ==================== */
.card {
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: #ffffff;
    font-weight: 600;
    padding: 1rem 1.25rem;
    border-bottom: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
}

.card-header h5, .card-header h4 {
    color: #ffffff;
    margin: 0;
}

.card-header.bg-success {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-light) 100%) !important;
}

.card-header.bg-warning {
    background: linear-gradient(135deg, var(--warning) 0%, var(--warning-light) 100%) !important;
    color: #ffffff !important;
}

.card-header.bg-info {
    background: linear-gradient(135deg, var(--info) 0%, var(--primary-light) 100%) !important;
}

.card-header.bg-secondary {
    background: linear-gradient(135deg, var(--gray-600) 0%, var(--gray-500) 100%) !important;
}

.card-header.bg-dark {
    background: linear-gradient(135deg, var(--gray-800) 0%, var(--gray-700) 100%) !important;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    background-color: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    padding: 1rem 1.25rem;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg) !important;
}

/* ==================== FORMS ==================== */
.form-label {
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.form-control, .form-select {
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    transition: var(--transition);
    background-color: #ffffff;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.15);
    outline: none;
}

.form-control::placeholder {
    color: var(--gray-400);
}

.form-control[readonly] {
    background-color: var(--gray-100);
    color: var(--gray-600);
    cursor: not-allowed;
}

.form-control.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(197, 48, 48, 0.15);
}

.form-control.is-valid {
    border-color: var(--success);
    box-shadow: 0 0 0 3px rgba(39, 103, 73, 0.15);
}

.invalid-feedback {
    color: var(--danger);
    font-size: 0.8125rem;
    margin-top: 0.25rem;
}

/* Input Groups */
.input-group-text {
    background-color: var(--gray-100);
    border: 1px solid var(--gray-300);
    color: var(--gray-600);
    font-weight: 500;
}

/* ==================== BUTTONS ==================== */
.btn {
    font-weight: 600;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    transition: var(--transition);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-transform: uppercase;
    font-size: 0.8125rem;
    letter-spacing: 0.05em;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

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

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    color: #ffffff;
}

.btn-success {
    background: linear-gradient(135deg, var(--success-light) 0%, var(--success) 100%);
    color: #ffffff;
}

.btn-success:hover {
    background: linear-gradient(135deg, var(--success) 0%, #1e5631 100%);
    color: #ffffff;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-light) 0%, var(--warning) 100%);
    color: #ffffff;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-light) 0%, var(--danger) 100%);
    color: #ffffff;
}

.btn-info {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--info) 100%);
    color: #ffffff;
}

.btn-secondary {
    background: linear-gradient(135deg, var(--gray-500) 0%, var(--gray-600) 100%);
    color: #ffffff;
}

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

.btn-outline-primary:hover {
    background: var(--primary);
    color: #ffffff;
}

.btn-outline-secondary {
    border: 2px solid var(--gray-400);
    color: var(--gray-600);
    background: transparent;
}

.btn-outline-secondary:hover {
    background: var(--gray-600);
    color: #ffffff;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 0.9375rem;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

/* ==================== TABLES ==================== */
.table {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 0;
}

.table thead th {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: #ffffff;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 1rem;
    border: none;
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-700);
}

.table tbody tr:hover {
    background-color: var(--gray-50);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ==================== BADGES ==================== */
.badge {
    font-weight: 600;
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius);
}

.badge.bg-primary {
    background-color: var(--primary) !important;
}

.badge.bg-success {
    background-color: var(--success) !important;
}

.badge.bg-warning {
    background-color: var(--warning) !important;
    color: #ffffff !important;
}

.badge.bg-danger {
    background-color: var(--danger) !important;
}

.badge.bg-info {
    background-color: var(--info) !important;
}

.badge.bg-secondary {
    background-color: var(--gray-500) !important;
}

/* Status Badges */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.badge-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ==================== ALERTS ==================== */
.alert {
    border: none;
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid;
}

.alert-primary {
    background-color: #ebf4ff;
    color: var(--primary-dark);
    border-left-color: var(--primary);
}

.alert-success {
    background-color: #f0fff4;
    color: var(--success);
    border-left-color: var(--success);
}

.alert-warning {
    background-color: #fffaf0;
    color: var(--warning);
    border-left-color: var(--warning);
}

.alert-danger {
    background-color: #fff5f5;
    color: var(--danger);
    border-left-color: var(--danger);
}

.alert-info {
    background-color: #ebf8ff;
    color: var(--info);
    border-left-color: var(--info);
}

/* ==================== PROGRESS STEPS ==================== */
.progress-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.progress-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 20px;
    left: 60%;
    width: 80%;
    height: 3px;
    background: var(--gray-300);
    z-index: 1;
}

.progress-step.completed:not(:last-child)::after {
    background: var(--success);
}

.progress-step.active:not(:last-child)::after {
    background: linear-gradient(90deg, var(--success) 50%, var(--gray-300) 50%);
}

.step-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    background: var(--gray-200);
    color: var(--gray-500);
    position: relative;
    z-index: 2;
    transition: var(--transition);
}

.progress-step.completed .step-icon {
    background: var(--success);
    color: #ffffff;
}

.progress-step.active .step-icon {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 0 0 4px rgba(44, 82, 130, 0.2);
}

.step-label {
    margin-top: 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.progress-step.completed .step-label,
.progress-step.active .step-label {
    color: var(--gray-700);
}

/* Locked step (admin-only) */
.progress-step.locked .step-icon {
    background-color: var(--gray-400);
    color: white;
}

.progress-step.locked .step-label {
    color: var(--gray-500);
}

.progress-step.locked:not(:last-child)::after {
    background-color: var(--gray-300);
}

/* ==================== FILE UPLOAD ==================== */
.file-upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    transition: var(--transition);
    background-color: var(--gray-50);
    cursor: pointer;
}

.file-upload-area:hover {
    border-color: var(--primary);
    background-color: #ebf4ff;
}

.file-upload-area.dragover {
    border-color: var(--primary);
    background-color: #ebf4ff;
    box-shadow: 0 0 0 4px rgba(44, 82, 130, 0.1);
}

.file-upload-icon {
    font-size: 3rem;
    color: var(--gray-400);
    margin-bottom: 1rem;
}

.file-upload-area:hover .file-upload-icon {
    color: var(--primary);
}

/* ==================== DOCUMENT CARDS ==================== */
.document-card {
    background: var(--bg-card);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}

.document-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.document-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.document-icon.pdf {
    background-color: #fff5f5;
    color: var(--danger);
}

.document-icon.image {
    background-color: #ebf4ff;
    color: var(--primary);
}

.document-info {
    flex: 1;
}

.document-name {
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.document-meta {
    font-size: 0.8125rem;
    color: var(--gray-500);
}

/* ==================== STATS CARDS ==================== */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.5rem;
}

.stat-card.success {
    border-left-color: var(--success);
}

.stat-card.warning {
    border-left-color: var(--warning);
}

.stat-card.danger {
    border-left-color: var(--danger);
}

/* ==================== FOOTER ==================== */
footer {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: rgba(255, 255, 255, 0.8);
    padding: 1.5rem 0;
    margin-top: auto;
    border-top: 3px solid var(--accent-gold);
}

footer a {
    color: var(--accent-gold);
    text-decoration: none;
}

footer a:hover {
    color: var(--accent-gold-light);
}

/* ==================== LOGIN PAGE ==================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    padding: 2rem;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    max-width: 420px;
    width: 100%;
}

.login-header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: #ffffff;
    padding: 2rem;
    text-align: center;
    border-bottom: 3px solid var(--accent-gold);
}

.login-header h2 {
    color: #ffffff;
    margin: 0;
    font-size: 1.5rem;
}

.login-header .icon {
    font-size: 3rem;
    color: var(--accent-gold);
    margin-bottom: 1rem;
}

.login-body {
    padding: 2rem;
}

/* ==================== VOICE INPUT ==================== */
.voice-record-btn {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-light) 100%);
    color: #ffffff;
    font-size: 2.5rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
}

.voice-record-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-xl);
}

.voice-record-btn.recording {
    animation: pulse 1.5s infinite;
    background: linear-gradient(135deg, #e53e3e 0%, #fc8181 100%);
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(229, 62, 62, 0.4);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(229, 62, 62, 0);
    }
}

/* ==================== ANIMATIONS ==================== */
.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

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

/* ==================== UTILITIES ==================== */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--text-muted) !important; }

.bg-primary-subtle { background-color: #ebf4ff !important; }
.bg-success-subtle { background-color: #f0fff4 !important; }
.bg-warning-subtle { background-color: #fffaf0 !important; }
.bg-danger-subtle { background-color: #fff5f5 !important; }

.border-primary { border-color: var(--primary) !important; }
.border-success { border-color: var(--success) !important; }
.border-warning { border-color: var(--warning) !important; }
.border-danger { border-color: var(--danger) !important; }

/* Gold accent text */
.text-gold {
    color: var(--accent-gold) !important;
}

/* Divider with text */
.divider {
    display: flex;
    align-items: center;
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-400);
    letter-spacing: 0.1em;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-300);
}

.divider::before {
    margin-right: 1rem;
}

.divider::after {
    margin-left: 1rem;
}

/* Section Headers */
.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--gray-200);
}

.section-header h4, .section-header h5 {
    margin: 0;
    color: var(--primary-dark);
}

.section-header .icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #ffffff;
}

/* ==================== RESPONSIVE - MOBILE FRIENDLY ==================== */

/* Large tablets and below */
@media (max-width: 992px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .card-header h5 {
        font-size: 1rem;
    }
}

/* Tablets and below */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .navbar-brand span {
        display: none;
    }
    
    .progress-steps {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .progress-step:not(:last-child)::after {
        display: none;
    }
    
    .step-icon {
        width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }
    
    .step-label {
        font-size: 0.75rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }
    
    .btn-lg {
        padding: 0.625rem 1.25rem;
        font-size: 0.8125rem;
    }
    
    .stat-card .stat-value {
        font-size: 1.5rem;
    }
    
    .stat-card {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }
    
    /* Table mobile styles */
    .table thead th {
        font-size: 0.6875rem;
        padding: 0.75rem 0.5rem;
    }
    
    .table tbody td {
        padding: 0.75rem 0.5rem;
        font-size: 0.8125rem;
    }
    
    /* Hide some columns on mobile */
    .table .hide-mobile {
        display: none;
    }
    
    /* Form styles */
    .form-label {
        font-size: 0.75rem;
    }
    
    .form-control, .form-select {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    
    /* Page header */
    .d-flex.justify-content-between.align-items-center.mb-4 {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }
    
    .d-flex.justify-content-between.align-items-center.mb-4 .btn {
        width: 100%;
    }
    
    /* Crop history tables */
    .crop-history-table {
        font-size: 0.75rem;
    }
    
    .crop-history-table th {
        font-size: 0.6875rem;
        padding: 0.5rem 0.25rem;
    }
    
    .crop-history-table td {
        padding: 0.25rem 0.125rem;
    }
    
    .crop-history-table input.form-control-sm {
        font-size: 0.75rem;
        padding: 0.2rem 0.3rem;
    }
    
    /* Document upload boxes */
    .document-upload-box {
        padding: 0.75rem !important;
    }
    
    .document-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .document-upload-box h6 {
        font-size: 0.875rem;
    }
    
    /* Sidebar on mobile */
    .col-lg-3.mb-4 {
        order: 2;
    }
    
    .col-lg-9 {
        order: 1;
    }
    
    /* Alert styles */
    .alert {
        padding: 0.75rem 1rem;
        font-size: 0.8125rem;
    }
    
    /* Modal styles */
    .modal-dialog {
        margin: 0.5rem;
    }
    
    /* Login page */
    .login-container {
        padding: 1rem;
    }
    
    .login-card {
        max-width: 100%;
    }
    
    .login-header {
        padding: 1.5rem;
    }
    
    .login-header .icon {
        font-size: 2.5rem;
    }
    
    .login-header h2 {
        font-size: 1.25rem;
    }
    
    .login-body {
        padding: 1.5rem;
    }
}

/* Mobile phones */
@media (max-width: 576px) {
    body {
        font-size: 0.875rem;
    }
    
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.375rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.125rem; }
    h5 { font-size: 1rem; }
    h6 { font-size: 0.9375rem; }
    
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .navbar {
        padding: 0.5rem 0.75rem;
    }
    
    .navbar-brand {
        font-size: 1rem;
    }
    
    .card {
        margin-bottom: 1rem;
        border-radius: var(--radius-md);
    }
    
    .card-header {
        padding: 0.75rem 1rem;
        border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    /* Stats row on mobile */
    .row.mb-4 > [class*="col-"] {
        margin-bottom: 0.5rem;
    }
    
    .stat-card {
        padding: 0.75rem;
    }
    
    .stat-card .stat-value {
        font-size: 1.25rem;
    }
    
    .stat-card .stat-label {
        font-size: 0.6875rem;
    }
    
    /* Button group on mobile */
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        border-radius: var(--radius) !important;
        margin-bottom: 0.25rem;
    }
    
    /* Action buttons in table */
    td .btn-group {
        flex-direction: row;
        width: auto;
    }
    
    td .btn-group .btn {
        margin-bottom: 0;
        padding: 0.25rem 0.5rem;
    }
    
    /* Navigation buttons */
    .d-flex.justify-content-between.mb-4:last-child {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .d-flex.justify-content-between.mb-4:last-child .btn {
        width: 100%;
    }
    
    /* Form rows */
    .row.g-3 > [class*="col-"] {
        padding-left: 0.375rem;
        padding-right: 0.375rem;
    }
    
    /* Badges */
    .badge {
        font-size: 0.6875rem;
        padding: 0.3rem 0.5rem;
    }
    
    /* Crop history - hide intercrop on very small screens */
    .crop-history-table th:last-child,
    .crop-history-table td:last-child {
        display: none;
    }
    
    /* Footer */
    footer {
        padding: 1rem 0;
        font-size: 0.8125rem;
    }
}

/* ==================== PRINT STYLES ==================== */
@media print {
    .navbar, footer, .btn, .no-print {
        display: none !important;
    }
    
    body {
        background: #ffffff;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
}

/* ==================== CUSTOM SCROLLBAR ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* ==================== LOADING STATES ==================== */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ================================
   Crop History Tables
   ================================ */
.crop-history-table {
    margin-bottom: 0;
}

.crop-history-table th {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    padding: 0.625rem 0.5rem;
    white-space: nowrap;
}

.crop-history-table td {
    padding: 0.375rem 0.25rem;
    vertical-align: middle;
}

.crop-history-table input.form-control-sm {
    font-size: 0.8125rem;
    padding: 0.25rem 0.5rem;
    border-color: var(--gray-200);
}

.crop-history-table input.form-control-sm:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 2px rgba(49, 130, 206, 0.1);
}

.crop-history-table input[type="number"] {
    text-align: right;
}

.crop-history-table .table-success {
    background-color: #c6f6d5 !important;
}

.crop-history-table .table-primary {
    background-color: #bee3f8 !important;
}

.crop-history-table .table-warning {
    background-color: #fefcbf !important;
}
