body {
    background-color: #121212;
    padding-top: 4.5rem; /* space for fixed navbar */
    font-size: 0.95rem;  /* slightly larger base font for readability */
}
.card {
    background-color: #1e1e1e;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,.6);
    margin-bottom: 2rem;
}
.table-hover tbody tr:hover {
    background-color: rgba(255,255,255,0.05);
}
table {
    color: #e0e0e0;
}
.btn-primary {
    --bs-btn-bg: #0d6efd;
    --bs-btn-border-color: #0d6efd;
}
.btn-primary:hover {
    --bs-btn-bg: #0b5ed7;
    --bs-btn-border-color: #0b5ed7;
}
.navbar-brand {
    font-weight: 600;
}
/* Form improvements */
.form-control, .form-select {
    background-color: #2a2a2a;
    border-color: #404040;
    color: #e0e0e0;
}

.form-control:focus, .form-select:focus {
    background-color: #2a2a2a;
    border-color: #0d6efd;
    color: #e0e0e0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.form-label {
    color: #e0e0e0;
    margin-bottom: 0.5rem;
}

/* Card improvements */
.card-header {
    background-color: #252525;
    border-bottom-color: #404040;
}

/* Progress bar improvements */
.progress {
    background-color: #2a2a2a;
}

/* Mobile tweaks */
@media (max-width: 576px) {
    h1, h2, h3 {
        font-size: 1.25rem;
    }
    .btn {
        font-size: 0.9rem;
        padding: 0.5rem 0.9rem;
    }
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .card-body {
        padding: 1rem;
    }
    .card-header {
        padding: 0.75rem 1rem;
    }
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* Tablet tweaks */
@media (min-width: 577px) and (max-width: 768px) {
    .card-body {
        padding: 1.25rem;
    }
}

/* Flatpickr mobile-friendly styles */
.datetimepicker {
    cursor: pointer;
    touch-action: manipulation;
}

/* =====================================================
   Recipient List Selection Cards - Mobile-Friendly
   ===================================================== */
.recipient-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
    max-height: 350px;
    overflow-y: auto;
    padding: 0.5rem;
    background-color: #1a1a1a;
    border: 1px solid #404040;
    border-radius: 0.5rem;
}

.recipient-list-card {
    background-color: #2a2a2a;
    border: 2px solid #404040;
    border-radius: 0.75rem;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 60px;
    display: flex;
    align-items: center;
}

.recipient-list-card:hover {
    background-color: #333333;
    border-color: #555555;
}

.recipient-list-card:active {
    transform: scale(0.98);
    background-color: #383838;
}

.recipient-list-card.selected {
    background-color: rgba(13, 110, 253, 0.15);
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}

.recipient-list-card.selected:hover {
    background-color: rgba(13, 110, 253, 0.25);
    border-color: #3d8bfd;
}

.recipient-list-card-content {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 0.75rem;
}

.recipient-list-check-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background-color: #404040;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 1.1rem;
}

.recipient-list-check-icon i {
    opacity: 0;
    color: #ffffff;
    transition: opacity 0.2s ease;
}

.recipient-list-card.selected .recipient-list-check-icon {
    background-color: #0d6efd;
}

.recipient-list-card.selected .recipient-list-check-icon i {
    opacity: 1;
}

.recipient-list-info {
    flex: 1;
    overflow: hidden;
}

.recipient-list-name {
    display: block;
    font-weight: 500;
    color: #e0e0e0;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recipient-list-card.selected .recipient-list-name {
    color: #ffffff;
}

/* Mobile optimizations for recipient list */
@media (max-width: 576px) {
    .recipient-list-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        max-height: 300px;
        padding: 0.375rem;
    }
    
    .recipient-list-card {
        padding: 0.875rem 1rem;
        min-height: 56px;
        border-radius: 0.625rem;
    }
    
    .recipient-list-check-icon {
        width: 36px;
        height: 36px;
        min-width: 36px;
        font-size: 1.25rem;
    }
    
    .recipient-list-name {
        font-size: 1rem;
    }
}

/* Tablet optimizations */
@media (min-width: 577px) and (max-width: 768px) {
    .recipient-list-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile-specific flatpickr calendar styles */
@media (max-width: 768px) {
    .datetimepicker {
        font-size: 16px !important; /* Prevents zoom on iOS when focused */
    }
    
    .flatpickr-calendar {
        font-size: 16px !important; /* Prevents zoom on iOS */
        max-width: calc(100vw - 2rem);
        width: auto !important;
    }
    
    .flatpickr-months {
        padding: 0.75rem;
    }
    
    .flatpickr-weekdays {
        padding: 0.5rem 0;
    }
    
    .flatpickr-day {
        height: 2.5rem;
        line-height: 2.5rem;
        font-size: 0.95rem;
        min-width: 2.5rem;
        margin: 0.15rem;
    }
    
    .flatpickr-time {
        padding: 0.5rem;
    }
    
    .flatpickr-time input {
        font-size: 16px !important; /* Prevents zoom on iOS */
        height: 2.5rem;
        min-width: 3rem;
    }
    
    /* Make calendar buttons larger for touch */
    .flatpickr-prev-month,
    .flatpickr-next-month {
        padding: 0.75rem;
        height: 2.5rem;
        width: 2.5rem;
        min-width: 2.5rem;
    }
    
    /* Ensure calendar has high z-index and is visible */
    .flatpickr-calendar.open {
        z-index: 9999 !important;
    }
    
    /* When appended to body, center it on mobile view */
    body > .flatpickr-calendar.open {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%);
        max-height: 90vh;
        overflow-y: auto;
        box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.8);
    }
    
    /* Ensure calendar is clickable and visible */
    .flatpickr-calendar.open .flatpickr-day,
    .flatpickr-calendar.open .flatpickr-time input {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(13, 110, 253, 0.3);
    }
}
