/**
 * Mobile-Optimized Styles for HoneyguideSaccos
 *
 * Purpose: Reduce clutter, improve readability, and optimize layout for mobile devices
 * Target: All modules - Login, Dashboard, Forms, Tables, Cards, etc.
 *
 * Breakpoints:
 * - Mobile: < 576px
 * - Tablet: 576px - 768px
 * - Desktop: > 768px
 */

/* ========================================
   GLOBAL MOBILE OPTIMIZATIONS
   ======================================== */

/* Reduce overall padding and margins on mobile */
@media (max-width: 768px) {
    body {
        font-size: 14px !important;
        line-height: 1.4;
    }

    .container,
    .container-fluid {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    h1 {
        font-size: 1.5rem !important;
        margin-bottom: 0.75rem !important;
    }

    h2 {
        font-size: 1.3rem !important;
        margin-bottom: 0.6rem !important;
    }

    h3 {
        font-size: 1.15rem !important;
        margin-bottom: 0.5rem !important;
    }

    h4 {
        font-size: 1rem !important;
        margin-bottom: 0.4rem !important;
    }

    h5, h6 {
        font-size: 0.95rem !important;
        margin-bottom: 0.3rem !important;
    }
}

/* ========================================
   AUTHENTICATION PAGES (Login, Register)
   ======================================== */

@media (max-width: 768px) {
    /* Login/Register Card */
    .card {
        margin-top: 1rem !important;
        margin-bottom: 1rem !important;
    }

    .card-body {
        padding: 1rem !important;
    }

    .card-header {
        padding: 0.75rem 1rem !important;
        font-size: 1rem !important;
    }

    /* Logo sizing */
    .card-body img[alt*="Logo"],
    .card-body img[src*="logo"] {
        max-width: 120px !important;
        height: auto !important;
        margin-bottom: 0.5rem !important;
    }

    /* Form fields */
    .form-label {
        font-size: 0.875rem !important;
        margin-bottom: 0.3rem !important;
        font-weight: 600;
    }

    .form-control,
    .form-select {
        font-size: 0.9rem !important;
        padding: 0.5rem 0.75rem !important;
        height: auto !important;
    }

    .btn {
        padding: 0.6rem 1rem !important;
        font-size: 0.9rem !important;
    }

    /* Alert cards */
    .alert {
        padding: 0.75rem !important;
        font-size: 0.875rem !important;
        margin-bottom: 0.75rem !important;
    }

    .alert ul {
        margin-bottom: 0 !important;
        padding-left: 1.25rem !important;
    }

    .alert li {
        font-size: 0.85rem !important;
    }
}

/* ========================================
   DASHBOARD & STATISTICS CARDS
   ======================================== */

@media (max-width: 768px) {
    /* Page header */
    .page-header,
    .gradient-banner {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }

    .page-header h1,
    .gradient-banner h1 {
        font-size: 1.3rem !important;
    }

    .page-header p,
    .gradient-banner p {
        font-size: 0.85rem !important;
        margin-bottom: 0 !important;
    }

    /* Statistics cards grid */
    .stat-grid,
    [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
        margin-bottom: 1rem !important;
    }

    /* Individual stat cards */
    .stat-card {
        padding: 0.75rem !important;
        margin-bottom: 0 !important;
    }

    .stat-label {
        font-size: 0.75rem !important;
        margin-bottom: 0.25rem !important;
    }

    .stat-label i {
        font-size: 0.75rem !important;
        margin-right: 0.25rem !important;
    }

    .stat-value {
        font-size: 1.25rem !important;
        font-weight: 700 !important;
        margin-bottom: 0.25rem !important;
    }

    .stat-change {
        font-size: 0.7rem !important;
    }

    .stat-change i {
        font-size: 0.7rem !important;
    }

    /* Modern card component */
    .modern-card {
        padding: 0.75rem !important;
        margin-bottom: 0.75rem !important;
    }

    .modern-card h3,
    .modern-card h4 {
        font-size: 1rem !important;
        margin-bottom: 0.5rem !important;
    }

    .modern-card p {
        font-size: 0.85rem !important;
        margin-bottom: 0.4rem !important;
    }
}

/* ========================================
   TABLES & DATA DISPLAY
   ======================================== */

@media (max-width: 768px) {
    /* Hide desktop tables on mobile */
    .table-responsive table {
        display: none !important;
    }

    /* Show mobile cards instead */
    .mobile-card-view {
        display: block !important;
    }

    /* Mobile card styling */
    .mobile-card {
        background: white;
        border: 1px solid #dee2e6;
        border-radius: 0.5rem;
        padding: 0.75rem;
        margin-bottom: 0.75rem;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }

    .mobile-card-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 0.5rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid #e9ecef;
    }

    .mobile-card-title {
        font-size: 0.95rem;
        font-weight: 600;
        color: #2c3e50;
        margin: 0;
    }

    .mobile-card-badge {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
        border-radius: 0.25rem;
    }

    .mobile-card-body {
        padding: 0.25rem 0;
    }

    .mobile-card-row {
        display: flex;
        justify-content: space-between;
        padding: 0.3rem 0;
        font-size: 0.85rem;
    }

    .mobile-card-label {
        font-weight: 600;
        color: #6c757d;
        font-size: 0.8rem;
    }

    .mobile-card-value {
        color: #2c3e50;
        text-align: right;
        font-size: 0.85rem;
    }

    .mobile-card-actions {
        display: flex;
        gap: 0.5rem;
        margin-top: 0.75rem;
        padding-top: 0.5rem;
        border-top: 1px solid #e9ecef;
    }

    .mobile-card-actions .btn {
        flex: 1;
        padding: 0.4rem 0.5rem;
        font-size: 0.8rem;
    }

    .mobile-card-actions .btn i {
        font-size: 0.8rem;
    }
}

/* ========================================
   FORMS & INPUT PAGES
   ======================================== */

@media (max-width: 768px) {
    /* Form sections */
    .form-section {
        margin-bottom: 1rem !important;
    }

    .form-section-title {
        font-size: 1rem !important;
        padding: 0.5rem 0.75rem !important;
        margin-bottom: 0.75rem !important;
    }

    /* Form groups */
    .mb-3,
    .form-group {
        margin-bottom: 0.75rem !important;
    }

    /* Input groups */
    .input-group {
        margin-bottom: 0.75rem !important;
    }

    .input-group-text {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.875rem !important;
    }

    /* Checkboxes and radios */
    .form-check {
        padding-left: 1.5rem !important;
        margin-bottom: 0.5rem !important;
    }

    .form-check-label {
        font-size: 0.875rem !important;
    }

    /* Form buttons */
    .form-actions,
    .d-flex.gap-2 {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    .form-actions .btn,
    .d-flex.gap-2 .btn {
        width: 100% !important;
    }

    /* Multi-step forms */
    .step-indicator {
        font-size: 0.8rem !important;
        padding: 0.4rem 0.6rem !important;
    }

    .step-title {
        font-size: 0.9rem !important;
    }

    /* File upload */
    .custom-file-label {
        font-size: 0.875rem !important;
        padding: 0.5rem 0.75rem !important;
    }
}

/* ========================================
   NAVIGATION & MENUS
   ======================================== */

@media (max-width: 768px) {
    /* Navbar */
    .navbar-brand {
        font-size: 1.1rem !important;
    }

    .navbar-nav {
        padding: 0.5rem 0 !important;
    }

    .nav-link {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.9rem !important;
    }

    /* Sidebar navigation */
    .sidebar {
        width: 100% !important;
        position: relative !important;
    }

    .sidebar-item {
        padding: 0.6rem 1rem !important;
        font-size: 0.9rem !important;
    }

    /* Dropdown menus */
    .dropdown-menu {
        font-size: 0.875rem !important;
    }

    .dropdown-item {
        padding: 0.5rem 1rem !important;
    }
}

/* ========================================
   BUTTONS & ACTION ELEMENTS
   ======================================== */

@media (max-width: 768px) {
    /* Button sizing */
    .btn-sm {
        padding: 0.35rem 0.6rem !important;
        font-size: 0.8rem !important;
    }

    .btn-lg {
        padding: 0.7rem 1.2rem !important;
        font-size: 1rem !important;
    }

    /* Button groups */
    .btn-group {
        flex-direction: column !important;
        width: 100% !important;
    }

    .btn-group .btn {
        width: 100% !important;
        border-radius: 0.375rem !important;
        margin-bottom: 0.25rem !important;
    }

    /* Action buttons container */
    .action-buttons,
    .btn-toolbar {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    .action-buttons .btn,
    .btn-toolbar .btn {
        width: 100% !important;
    }
}

/* ========================================
   BADGES & LABELS
   ======================================== */

@media (max-width: 768px) {
    .badge {
        font-size: 0.7rem !important;
        padding: 0.25rem 0.5rem !important;
    }

    .badge-lg {
        font-size: 0.8rem !important;
        padding: 0.3rem 0.6rem !important;
    }
}

/* ========================================
   MODALS & DIALOGS
   ======================================== */

@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem !important;
        max-width: calc(100% - 1rem) !important;
    }

    .modal-header {
        padding: 0.75rem 1rem !important;
    }

    .modal-title {
        font-size: 1.1rem !important;
    }

    .modal-body {
        padding: 1rem !important;
        font-size: 0.9rem !important;
    }

    .modal-footer {
        padding: 0.75rem 1rem !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    .modal-footer .btn {
        width: 100% !important;
    }
}

/* ========================================
   PROGRESS BARS & INDICATORS
   ======================================== */

@media (max-width: 768px) {
    .progress {
        height: 1rem !important;
        font-size: 0.7rem !important;
        margin-bottom: 0.5rem !important;
    }

    .progress-label {
        font-size: 0.8rem !important;
        margin-bottom: 0.25rem !important;
    }
}

/* ========================================
   CHARTS & VISUALIZATIONS
   ======================================== */

@media (max-width: 768px) {
    canvas {
        max-height: 250px !important;
    }

    .chart-container {
        padding: 0.75rem !important;
        margin-bottom: 1rem !important;
    }

    .chart-title {
        font-size: 0.95rem !important;
        margin-bottom: 0.5rem !important;
    }
}

/* ========================================
   PAGINATION
   ======================================== */

@media (max-width: 768px) {
    .pagination {
        font-size: 0.85rem !important;
        justify-content: center !important;
        flex-wrap: wrap !important;
    }

    .page-link {
        padding: 0.4rem 0.65rem !important;
    }

    /* Hide some pagination buttons on very small screens */
    @media (max-width: 400px) {
        .pagination li:not(.active):not(:first-child):not(:last-child):not(:nth-child(2)):not(:nth-last-child(2)) {
            display: none !important;
        }
    }
}

/* ========================================
   BREADCRUMBS
   ======================================== */

@media (max-width: 768px) {
    .breadcrumb {
        font-size: 0.8rem !important;
        padding: 0.5rem 0.75rem !important;
        margin-bottom: 0.75rem !important;
        flex-wrap: wrap !important;
    }

    .breadcrumb-item {
        padding: 0.1rem 0 !important;
    }
}

/* ========================================
   TABS
   ======================================== */

@media (max-width: 768px) {
    .nav-tabs {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .nav-tabs .nav-link {
        font-size: 0.85rem !important;
        padding: 0.5rem 0.75rem !important;
        white-space: nowrap;
    }

    .tab-content {
        padding: 0.75rem 0.5rem !important;
    }
}

/* ========================================
   LISTS & LIST GROUPS
   ======================================== */

@media (max-width: 768px) {
    .list-group-item {
        padding: 0.75rem !important;
        font-size: 0.875rem !important;
    }

    .list-group-item h5,
    .list-group-item h6 {
        font-size: 0.95rem !important;
    }

    .list-group-item p {
        font-size: 0.85rem !important;
        margin-bottom: 0.25rem !important;
    }
}

/* ========================================
   EMPTY STATES
   ======================================== */

@media (max-width: 768px) {
    .empty-state {
        padding: 2rem 1rem !important;
    }

    .empty-state i {
        font-size: 2.5rem !important;
        margin-bottom: 0.75rem !important;
    }

    .empty-state h3 {
        font-size: 1.1rem !important;
    }

    .empty-state p {
        font-size: 0.875rem !important;
    }
}

/* ========================================
   TIMELINE (for loan schedules, etc.)
   ======================================== */

@media (max-width: 768px) {
    .timeline {
        padding-left: 1rem !important;
    }

    .timeline-item {
        padding-left: 1.5rem !important;
        margin-bottom: 1rem !important;
    }

    .timeline-marker {
        width: 0.75rem !important;
        height: 0.75rem !important;
        left: -0.4rem !important;
    }

    .timeline-content {
        padding: 0.75rem !important;
    }

    .timeline-title {
        font-size: 0.9rem !important;
    }

    .timeline-text {
        font-size: 0.85rem !important;
    }
}

/* ========================================
   SPECIFIC MODULE OPTIMIZATIONS
   ======================================== */

/* Loan Application Form */
@media (max-width: 768px) {
    .loan-application-steps {
        margin-bottom: 1rem !important;
    }

    .step {
        padding: 0.5rem !important;
        font-size: 0.8rem !important;
    }

    .step-number {
        width: 1.5rem !important;
        height: 1.5rem !important;
        font-size: 0.75rem !important;
    }

    .calculator-result {
        padding: 0.75rem !important;
        margin: 0.75rem 0 !important;
    }

    .calculator-row {
        padding: 0.4rem 0 !important;
        font-size: 0.875rem !important;
    }
}

/* Member Details */
@media (max-width: 768px) {
    .member-avatar {
        width: 60px !important;
        height: 60px !important;
    }

    .member-info-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    .member-info-item {
        padding: 0.5rem !important;
    }

    .member-info-label {
        font-size: 0.75rem !important;
    }

    .member-info-value {
        font-size: 0.9rem !important;
    }
}

/* Financial Dashboard */
@media (max-width: 768px) {
    .financial-summary-card {
        padding: 0.75rem !important;
        margin-bottom: 0.75rem !important;
    }

    .financial-chart-container {
        height: 200px !important;
    }

    .metric-card {
        padding: 0.75rem !important;
    }

    .metric-value {
        font-size: 1.3rem !important;
    }

    .metric-label {
        font-size: 0.8rem !important;
    }
}

/* General Ledger */
@media (max-width: 768px) {
    .account-code {
        font-size: 0.85rem !important;
        font-family: monospace;
    }

    .debit-credit-row {
        display: flex;
        justify-content: space-between;
        padding: 0.4rem 0;
    }

    .debit-credit-row .label {
        font-size: 0.8rem !important;
    }

    .debit-credit-row .value {
        font-size: 0.875rem !important;
        font-weight: 600;
    }
}

/* ========================================
   UTILITY CLASSES FOR MOBILE
   ======================================== */

@media (max-width: 768px) {
    /* Hide on mobile */
    .hide-mobile {
        display: none !important;
    }

    /* Show only on mobile */
    .show-mobile {
        display: block !important;
    }

    /* Reduce spacing */
    .mobile-compact {
        padding: 0.5rem !important;
        margin-bottom: 0.5rem !important;
    }

    /* Full width on mobile */
    .mobile-full-width {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Center content on mobile */
    .mobile-center {
        text-align: center !important;
    }

    /* Stack columns on mobile */
    .mobile-stack > * {
        width: 100% !important;
        margin-bottom: 0.75rem !important;
    }
}

/* ========================================
   TOUCH-FRIENDLY INTERACTIONS
   ======================================== */

@media (max-width: 768px) and (hover: none) {
    /* Increase tap targets */
    a, button, .btn, .nav-link, .dropdown-item {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* Remove hover effects on touch devices */
    .btn:hover,
    .nav-link:hover,
    .card:hover {
        transform: none !important;
    }

    /* Better touch feedback */
    .btn:active,
    .card:active {
        opacity: 0.8;
        transform: scale(0.98);
    }
}

/* ========================================
   PRINT STYLES (when printing from mobile)
   ======================================== */

@media print {
    /* Hide mobile-specific elements */
    .mobile-card-actions,
    .btn,
    .navbar,
    .sidebar {
        display: none !important;
    }

    /* Show tables for printing */
    .table-responsive table {
        display: table !important;
    }

    .mobile-card-view {
        display: none !important;
    }

    /* Optimize page breaks */
    .card,
    .modern-card,
    .mobile-card {
        page-break-inside: avoid;
    }
}

/* ========================================
   ADDITIONAL MOBILE CARD VIEW OPTIMIZATION
   (For existing mobile card layouts in templates)
   ======================================== */

@media (max-width: 768px) {
    /* Switch from table to mobile card view */
    .table-responsive {
        display: none !important;
    }

    /* Show mobile card view (next sibling div after table-responsive) */
    .table-responsive + div[style*="display: none"] {
        display: block !important;
    }

    /* Reduce padding in mobile cards */
    .modern-card[style*="padding: 1rem"] {
        padding: 0.875rem !important;
    }

    /* Avatar sizing in mobile cards */
    div[style*="width: 48px; height: 48px; border-radius: 50%"],
    div[style*="width: 48px; height: 48px; border-radius: 10px"] {
        width: 40px !important;
        height: 40px !important;
        font-size: 14px !important;
    }

    div[style*="width: 50px; height: 50px; border-radius: 10px"] {
        width: 42px !important;
        height: 42px !important;
        font-size: 14px !important;
    }

    div[style*="width: 60px; height: 60px"] {
        width: 48px !important;
        height: 48px !important;
        font-size: 16px !important;
    }

    /* Card header text sizing */
    div[style*="font-weight: 700"][style*="font-size: 15px"] {
        font-size: 0.95rem !important;
    }

    div[style*="font-size: 12px"][style*="font-weight: 600"] {
        font-size: 0.75rem !important;
    }

    /* Grid layouts in mobile cards */
    div[style*="display: grid; grid-template-columns: 1fr 1fr"] {
        gap: 0.625rem !important;
        margin-bottom: 0.75rem !important;
        font-size: 0.875rem !important;
    }

    /* Label and value pairs */
    div[style*="font-size: 11px; margin-bottom: 0.25rem"] {
        font-size: 0.7rem !important;
    }

    /* Card action buttons */
    div[style*="grid-template-columns: repeat(auto-fit, minmax(80px, 1fr))"] {
        grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)) !important;
        gap: 0.5rem !important;
    }

    div[style*="grid-template-columns: repeat(auto-fit, minmax(80px, 1fr))"] .btn-modern {
        padding: 0.5rem 0.4rem !important;
        font-size: 0.75rem !important;
        justify-content: center !important;
    }

    /* Reduce margin in card list items */
    .modern-card[style*="margin-bottom: 1rem"] {
        margin-bottom: 0.75rem !important;
    }

    /* Financial values */
    div[style*="font-weight: 700"][style*="color: var(--accent-green)"],
    div[style*="font-weight: 700"][style*="color: var(--success)"] {
        font-size: 0.9rem !important;
    }
}

/* ========================================
   MODERN LAYOUT SPECIFIC (Sidebar + Main)
   ======================================== */

@media (max-width: 768px) {
    /* Modern sidebar when open on mobile */
    .modern-sidebar.mobile-open {
        width: 280px !important;
    }

    /* Sidebar sections */
    .nav-section {
        margin-bottom: 0.75rem !important;
    }

    .nav-section-title {
        font-size: 0.7rem !important;
        padding: 0.4rem 1rem !important;
    }

    .nav-item {
        margin-bottom: 0.125rem !important;
    }

    .nav-link {
        padding: 0.625rem 1rem !important;
        font-size: 0.875rem !important;
    }

    .nav-link i {
        font-size: 1rem !important;
        width: 20px !important;
    }

    .nav-link-badge {
        font-size: 0.7rem !important;
        padding: 0.125rem 0.4rem !important;
    }

    /* Sidebar logo */
    .sidebar-logo {
        padding: 0.875rem 1rem !important;
    }

    .sidebar-logo img {
        max-width: 35px !important;
    }

    .sidebar-logo-text {
        font-size: 1rem !important;
    }

    /* Sidebar user section */
    .sidebar-user {
        padding: 0.75rem 1rem !important;
    }

    .user-avatar {
        width: 36px !important;
        height: 36px !important;
        font-size: 0.875rem !important;
    }

    .user-name {
        font-size: 0.875rem !important;
    }

    .user-role {
        font-size: 0.7rem !important;
    }

    /* Top bar */
    .modern-topbar {
        padding: 0.75rem 1rem !important;
    }

    .topbar-search {
        display: none !important; /* Hide search on mobile to save space */
    }

    .topbar-btn {
        width: 36px !important;
        height: 36px !important;
        font-size: 0.95rem !important;
    }

    .topbar-btn .badge {
        font-size: 0.65rem !important;
        padding: 0.125rem 0.35rem !important;
    }

    /* Main content area */
    .modern-content {
        padding: 1rem 0.75rem !important;
    }

    /* Page header component */
    .page-header {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }

    .page-header h1 {
        font-size: 1.3rem !important;
    }

    .page-header p {
        font-size: 0.85rem !important;
    }

    .page-header .btn-modern {
        font-size: 0.85rem !important;
        padding: 0.5rem 0.75rem !important;
    }
}

/* ========================================
   STAT GRID & STAT CARDS (Modern Components)
   ======================================== */

@media (max-width: 768px) {
    /* Stat grid - force single column */
    .stat-grid,
    div[style*="display: grid"][style*="grid-template-columns"] {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
        margin-bottom: 1rem !important;
    }

    /* Individual stat card */
    .stat-card {
        padding: 0.75rem 1rem !important;
        margin-bottom: 0 !important;
    }

    .stat-card i {
        font-size: 1.5rem !important;
    }

    /* Specific stat card label/value adjustments */
    .stat-card .stat-label,
    div[class*="stat-label"] {
        font-size: 0.75rem !important;
    }

    .stat-card .stat-value,
    div[class*="stat-value"] {
        font-size: 1.35rem !important;
    }

    .stat-card .stat-subtitle,
    div[class*="stat-subtitle"] {
        font-size: 0.7rem !important;
    }
}

/* ========================================
   FILTERS & SEARCH SECTIONS
   ======================================== */

@media (max-width: 768px) {
    /* Filter section container */
    #filtersSection,
    .filter-section {
        padding: 0.875rem !important;
        margin-bottom: 1rem !important;
    }

    /* Filter grid */
    div[style*="grid-template-columns: repeat(auto-fit, minmax(200px, 1fr))"] {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    /* Form group modern */
    .form-group-modern {
        margin-bottom: 0.75rem !important;
    }

    .form-label-modern {
        font-size: 0.8rem !important;
        margin-bottom: 0.35rem !important;
    }

    .form-control-modern {
        font-size: 0.875rem !important;
        padding: 0.5rem 0.75rem !important;
    }

    /* Filter action buttons */
    div[style*="display: flex; gap: 0.75rem"] .btn-modern {
        flex: 1 1 auto;
        min-width: 0;
        font-size: 0.85rem !important;
        padding: 0.5rem 0.75rem !important;
    }
}

/* ========================================
   CARD HEADER & CARD COMPONENTS
   ======================================== */

@media (max-width: 768px) {
    /* Modern card */
    .modern-card {
        margin-bottom: 1rem !important;
    }

    .card-header {
        padding: 0.875rem 1rem !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5rem !important;
    }

    .card-title {
        font-size: 1rem !important;
        margin-bottom: 0.25rem !important;
    }

    .card-title i {
        font-size: 0.95rem !important;
    }

    /* Card header right section (badges, counts) */
    .card-header > div[style*="display: flex"] {
        width: 100% !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5rem !important;
    }

    /* Status badges in card headers */
    span[style*="padding: 0.25rem 0.75rem"] {
        padding: 0.25rem 0.6rem !important;
        font-size: 0.7rem !important;
    }
}

/* ========================================
   ALERT CARDS & NOTIFICATIONS
   ======================================== */

@media (max-width: 768px) {
    .alert-modern {
        padding: 0.75rem !important;
        font-size: 0.875rem !important;
        margin-bottom: 0.875rem !important;
    }

    .alert-modern i {
        font-size: 1rem !important;
    }

    /* Alert cards (custom component) */
    .alert-card {
        padding: 0.75rem !important;
        margin-bottom: 0.75rem !important;
    }

    .alert-card-title {
        font-size: 0.95rem !important;
    }

    .alert-card-badge {
        font-size: 0.7rem !important;
        padding: 0.2rem 0.5rem !important;
    }

    /* Overdue/pending items in alerts */
    div[style*="padding: 0.75rem 0"] {
        padding: 0.5rem 0 !important;
    }
}

/* ========================================
   QUICK ACTIONS & BUTTON CARDS
   ======================================== */

@media (max-width: 768px) {
    /* Quick actions section */
    div[style*="display: flex; flex-direction: column; gap: 0.75rem"] {
        gap: 0.625rem !important;
        padding: 1rem !important;
    }

    /* Action buttons in quick actions */
    .btn-modern[style*="width: 100%; justify-content: center"] {
        padding: 0.625rem 1rem !important;
        font-size: 0.9rem !important;
    }

    .btn-modern i {
        font-size: 0.9rem !important;
    }
}

/* ========================================
   DASHBOARD TWO-COLUMN LAYOUT
   ======================================== */

@media (max-width: 1024px) {
    /* Convert 2fr 1fr grid to single column on tablet/mobile */
    div[style*="grid-template-columns: 2fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    /* Recent activities */
    div[style*="padding: 1.25rem 1.5rem"] {
        padding: 0.875rem 1rem !important;
    }

    /* Activity title */
    h6[style*="font-size: 15px"] {
        font-size: 0.95rem !important;
    }

    /* Activity date/time */
    small[style*="white-space: nowrap"] {
        font-size: 0.7rem !important;
    }

    /* Activity description */
    p[style*="font-size: 14px"] {
        font-size: 0.85rem !important;
    }
}
