/* نظام إدارة الأقساط اليومية - ملف التنسيقات الرئيسي */
/* Mobile First Design with X-Menu Sidebar */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-light: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --sidebar-width: 280px;
    --header-height: 60px;
    /* تنسيق الجداول الموحّد */
    --table-header-bg: #3d4556;
    --table-header-color: #ffffff;
    --table-border: #6b7280;
    --table-row-odd: #ebe8f5;
    --table-row-even: #ffffff;
    --table-row-selected: #1a9fd6;
    --table-row-selected-text: #0c0c0c;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f1f5f9;
    color: var(--text-color);
    line-height: 1.6;
    direction: rtl;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    height: var(--header-height);
    background: #1e293b;
    color: white;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: white;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo {
    font-size: 1.25rem;
    font-weight: bold;
    color: white;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Sidebar - X-Menu Style */
.sidebar {
    position: fixed;
    top: var(--header-height);
    right: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: #1e293b;
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 999;
    overflow-y: auto;
}

.sidebar.active {
    transform: translateX(0);
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
}

.sidebar-menu li {
    margin: 0.25rem 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: all 0.2s;
    border-right: 3px solid transparent;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: rgba(255, 255, 255, 0.1);
    border-right-color: #3b82f6;
    color: white;
}

.sidebar-menu a i {
    margin-left: 0.75rem;
    width: 20px;
    text-align: center;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 998;
}

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

/* Main Content */
.main-content {
    margin-top: var(--header-height);
    padding: 1rem;
    min-height: calc(100vh - var(--header-height));
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    gap: 0.5rem;
}

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

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

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

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

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

.btn-block {
    width: 100%;
}

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

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Tables — رأس داكن، تدرج بنفسجي فاتح/أبيض، صف محدد سماوي غامق */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border: 1px solid var(--table-border);
}

.table th,
.table td {
    padding: 0.65rem 0.75rem;
    text-align: right;
    border: 1px solid var(--table-border);
    vertical-align: middle;
}

.table thead th {
    background: var(--table-header-bg);
    font-weight: 700;
    color: var(--table-header-color);
    text-align: center;
}

.table tbody td {
    color: var(--text-color);
}

/* شريط التناوب: فردي = بنفسجي رمادي فاتح، زوجي = أبيض */
.table tbody tr:nth-child(odd):not(.table-row-selected) {
    background-color: var(--table-row-odd);
}

.table tbody tr:nth-child(even):not(.table-row-selected) {
    background-color: var(--table-row-even);
}

.table tbody tr:hover:not(.table-row-selected) {
    filter: brightness(0.97);
}

/* صف محدد (انقر على الصف — باستثناء الأزرار والروابط) */
.table tbody tr.table-row-selected {
    background-color: var(--table-row-selected) !important;
    color: var(--table-row-selected-text);
}

.table tbody tr.table-row-selected td {
    color: var(--table-row-selected-text);
    border-color: #0d7aad;
    font-weight: 600;
}

/* جداول داخل بطاقات بدون تضارب */
.card .table {
    margin-bottom: 0;
}

/* الكشف اليومي (صفحة daily-report): ألوان العرض فقط — الحجم والحشو كالسابق من الملف */
.daily-report-colored-wrap table.table.daily-report-table.daily-report-screen-colored {
    width: 100%;
    border-collapse: collapse;
    border: 2px solid #1f2937;
    background: #fff;
}
.daily-report-colored-wrap table.table.daily-report-table.daily-report-screen-colored thead th {
    background-color: #3d4556 !important;
    color: #ffffff !important;
    border: 1px solid #1f2937 !important;
    text-align: center;
    vertical-align: middle;
}
.daily-report-colored-wrap table.table.daily-report-table.daily-report-screen-colored tbody td {
    border: 1px solid #4b5563 !important;
    color: #111;
    vertical-align: middle;
}
.daily-report-colored-wrap table.table.daily-report-table.daily-report-screen-colored tbody tr:nth-child(odd):not(.table-row-selected) td {
    background-color: #ebe8f5 !important;
}
.daily-report-colored-wrap table.table.daily-report-table.daily-report-screen-colored tbody tr:nth-child(even):not(.table-row-selected) td {
    background-color: #ffffff !important;
}
.daily-report-colored-wrap table.table.daily-report-table.daily-report-screen-colored tbody tr#dailyReportTotalsRow td {
    background-color: #e8e8e8 !important;
    border-top: 2px solid #1f2937 !important;
}
.daily-report-colored-wrap table.table.daily-report-table.daily-report-screen-colored tbody tr.table-row-selected td {
    background-color: var(--table-row-selected) !important;
    color: var(--table-row-selected-text) !important;
    border-color: #0d7aad !important;
}

/* الكشف اليومي المخصص — لون + مضغوط */
.custom-daily-table-wrap table.table.daily-report-table.custom-daily-report-table {
    width: 100%;
    border-collapse: collapse;
    border: 2px solid #1f2937;
    background: #fff;
}
.custom-daily-table-wrap table.table.daily-report-table.custom-daily-report-table thead th {
    background-color: #3d4556 !important;
    color: #ffffff !important;
    border: 1px solid #1f2937 !important;
    font-weight: bold;
    text-align: center;
    vertical-align: middle;
}
.custom-daily-table-wrap table.table.daily-report-table.custom-daily-report-table tbody td {
    border: 1px solid #4b5563 !important;
    font-weight: 600;
    color: #111;
    vertical-align: middle;
}
.custom-daily-table-wrap table.table.daily-report-table.custom-daily-report-table tbody tr:nth-child(odd):not(.table-row-selected) td {
    background-color: #ebe8f5 !important;
}
.custom-daily-table-wrap table.table.daily-report-table.custom-daily-report-table tbody tr:nth-child(even):not(.table-row-selected) td {
    background-color: #ffffff !important;
}
.custom-daily-table-wrap table.table.daily-report-table.custom-daily-report-table tbody tr.table-row-selected td {
    background-color: var(--table-row-selected) !important;
    color: var(--table-row-selected-text) !important;
    border-color: #0d7aad !important;
}
.custom-daily-table-wrap .custom-daily-compact thead th {
    padding: 0.45rem 0.5rem;
    font-size: 0.8125rem;
}
.custom-daily-table-wrap .custom-daily-compact tbody td {
    padding: 0.35rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.3;
}

/* مودال سجل الأقساط (installments) — نفس ثيم عرض الكشف اليومي المخصص */
#installmentsAuditLogModal .installments-audit-table-scroll {
    border-radius: 8px;
}
#installmentsAuditLogModal .custom-daily-table-wrap .badge-secondary {
    background-color: #4b5563;
    color: #fff;
    font-weight: 600;
}
#installmentsAuditLogModal .custom-daily-table-wrap .btn-sm {
    white-space: nowrap;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid var(--success-color);
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid var(--danger-color);
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid var(--info-color);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-card:nth-child(1) {
    border-left-color: #2563eb;
}

.stat-card:nth-child(2) {
    border-left-color: #10b981;
}

.stat-card:nth-child(3) {
    border-left-color: #f59e0b;
}

.stat-card:nth-child(4) {
    border-left-color: #ef4444;
}

.stat-card:nth-child(5) {
    border-left-color: #8b5cf6;
}

.stat-card:nth-child(6) {
    border-left-color: #06b6d4;
}

.stat-card-title {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.stat-card-value {
    font-size: 1.75rem;
    font-weight: bold;
    color: var(--text-color);
}

.stat-card-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-secondary {
    background: #e5e7eb;
    color: #374151;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.login-box {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 2rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.login-form {
    margin-top: 1.5rem;
}

/* Daily Payment Grid — 12 عموداً ثابت على الشاشات ≥768px (نفس منطق العرض على لوكل)؛
   repeat(auto-fill, minmax(80px)) كان يختلف حسب عرض المحتوى فتظهر 7 أو 10 أعمدة أونلاين */
.payment-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.payment-day {
    aspect-ratio: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0.3rem;
    box-sizing: border-box;
    position: relative;
}

.payment-day-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.15;
    width: 100%;
    max-width: 100%;
    text-align: center;
    padding: 0 2px;
    box-sizing: border-box;
}

.payment-day-content strong {
    display: block;
    font-size: clamp(0.7rem, 1.1vw, 1rem);
    font-weight: 700;
    line-height: 1.2;
}

.payment-day-content small {
    font-size: 10px;
    margin-top: 3px;
}

/* تاريخ اليوم داخل المربع: LTR حتى لا يختلط رقم اليوم مع التاريخ في الواجهة العربية */
.payment-day-date {
    direction: ltr;
    unicode-bidi: isolate;
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.payment-day-content .payment-amount {
    display: block;
    font-size: 10px;
    font-weight: 700;
    margin-top: 4px;
    line-height: 1.15;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.payment-day.paid {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.payment-day.overdue {
    background: var(--danger-color) !important;
    color: #fff !important;
    border-color: var(--danger-color) !important;
}

.payment-day.today {
    background: #f59e0b !important;
    color: #111827 !important;
    border-color: #f59e0b !important;
}

.payment-day.future {
    background: var(--card-bg) !important;
    color: var(--text-light) !important;
    border-color: var(--border-color) !important;
}

.payment-day.overdue:not(.empty):hover,
.payment-day.today:not(.empty):hover,
.payment-day.future:not(.empty):hover {
    filter: brightness(0.92);
}

.payment-day.locked {
    opacity: 0.85;
    pointer-events: none; /* يقفل النقر فقط بدون تغيير اللون */
}

.payment-day.empty {
    background: transparent;
    border-color: transparent;
    cursor: default;
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    
    .card-header {
        page-break-after: avoid;
    }
    
    table {
        page-break-inside: auto;
    }
    
    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    /* الكشف اليومي: ألوان الشاشة لا تُطبع — نفس مظهر الطباعة الكلاسيكية */
    .daily-report-colored-wrap table.table.daily-report-table.daily-report-screen-colored {
        border-color: #000 !important;
    }
    .daily-report-colored-wrap table.table.daily-report-table.daily-report-screen-colored thead th {
        background-color: #e0e0e0 !important;
        color: #000 !important;
        border-color: #000 !important;
    }
    .daily-report-colored-wrap table.table.daily-report-table.daily-report-screen-colored tbody td {
        border-color: #000 !important;
        color: #000 !important;
    }
    .daily-report-colored-wrap table.table.daily-report-table.daily-report-screen-colored tbody tr:nth-child(odd):not(.table-row-selected) td,
    .daily-report-colored-wrap table.table.daily-report-table.daily-report-screen-colored tbody tr:nth-child(even):not(.table-row-selected) td {
        background-color: #fff !important;
    }
    .daily-report-colored-wrap table.table.daily-report-table.daily-report-screen-colored tbody tr#dailyReportTotalsRow td {
        background-color: #e0e4ec !important;
        border-top-color: #000 !important;
    }
}

/* Mobile Optimizations */
@media (max-width: 767px) {
    :root {
        --header-height: 56px;
        --sidebar-width: 85vw;
    }
    
    body {
        font-size: 14px;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    .header {
        padding: 0 0.75rem;
        height: var(--header-height);
    }
    
    .logo {
        font-size: 1rem;
    }
    
    .user-info {
        font-size: 0.75rem;
        gap: 0.25rem;
    }
    
    .user-info span {
        display: none;
    }
    
    .main-content {
        padding: 0.75rem;
        margin-top: var(--header-height);
    }
    
    .card {
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 12px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding-bottom: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .card-title {
        font-size: 1.1rem;
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-card-value {
        font-size: 1.5rem;
    }
    
    .stat-card-icon {
        font-size: 1.5rem;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.375rem;
        white-space: nowrap;
    }
    
    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
        min-height: 44px; /* Touch target size */
    }
    
    .btn-sm {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
        min-height: 36px;
    }
    
    .form-control {
        padding: 0.875rem;
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 44px;
    }
    
    .payment-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 0.35rem;
    }
    
    .payment-day {
        font-size: 0.7rem;
        min-height: 0;
        padding: 0.2rem;
    }

    .payment-day-content strong {
        font-size: 0.7rem;
    }

    .payment-day-content .payment-amount {
        font-size: 8px;
    }
    
    .sidebar-menu a {
        padding: 1rem 1.25rem;
        font-size: 0.9375rem;
        min-height: 48px;
    }
    
    .d-flex {
        flex-wrap: wrap;
    }
    
    .gap-2 {
        gap: 0.5rem !important;
    }
    
    /* تحسين الجداول للجوال */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
    }
    
    /* تحسين النماذج */
    .form-group {
        margin-bottom: 1.25rem;
    }
    
    /* تحسين الأزرار */
    .btn-block {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    /* تحسين البطاقات */
    .badge {
        font-size: 0.6875rem;
        padding: 0.25rem 0.5rem;
    }
    
    /* إخفاء بعض العناصر على الجوال */
    .header-right .user-info .badge {
        display: none;
    }
}

/* Tablet Optimizations */
@media (min-width: 768px) and (max-width: 1023px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .payment-grid {
        grid-template-columns: repeat(12, minmax(0, 1fr));
        gap: 0.45rem;
    }
}

/* Desktop */
@media (min-width: 768px) {
    .sidebar {
        transform: translateX(0);
    }
    
    .main-content {
        margin-right: var(--sidebar-width);
    }
    
    .menu-toggle {
        display: none;
    }
    
    .overlay {
        display: none;
    }
}

/* PWA Install Button */
.install-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-bg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    z-index: 10000;
    display: none;
    align-items: center;
    gap: 1rem;
    max-width: 90%;
    animation: slideUp 0.3s ease;
}

.install-prompt.show {
    display: flex;
}

.install-prompt-content {
    flex: 1;
}

.install-prompt-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-size: 0.9375rem;
}

.install-prompt-text {
    font-size: 0.8125rem;
    color: var(--text-light);
}

.install-prompt-actions {
    display: flex;
    gap: 0.5rem;
}

.install-prompt-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.install-prompt-btn.primary {
    background: var(--primary-color);
    color: white;
}

.install-prompt-btn.secondary {
    background: var(--bg-color);
    color: var(--text-color);
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Safe Area for iOS */
@supports (padding: max(0px)) {
    .main-content {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
    
    .header {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
}

/* Loading Spinner */
.spinner {
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

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

/* Utilities */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.d-flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

/* Touch optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        opacity: 1;
    }
    
    .btn:active {
        opacity: 0.8;
        transform: scale(0.98);
    }
    
    .payment-day:active {
        transform: scale(0.95);
    }
    
    .sidebar-menu a:active {
        background: var(--primary-color);
        color: white;
    }
}

/* Prevent text selection on buttons */
.btn, .payment-day {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

body {
    -webkit-tap-highlight-color: transparent;
}

/* Better focus indicators for accessibility */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Improve form inputs on mobile */
@media (max-width: 767px) {
    input[type="text"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    textarea,
    select {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
    
    /* Larger touch targets */
    a, button, .btn {
        min-height: 44px;
        min-width: 44px;
    }
}

