/* ============================================
   Mobile Bottom Navigation
   ============================================ */

.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 2px solid #0F5940;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1), 0 -2px 4px -1px rgba(0, 0, 0, 0.06);
    z-index: 40;
    padding-bottom: env(safe-area-inset-bottom); /* iOS safe area */
}

.mobile-bottom-nav .nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 64px;
}

.mobile-bottom-nav .nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    color: #6B7280;
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
}

.mobile-bottom-nav .nav-item:active {
    transform: scale(0.95);
}

.mobile-bottom-nav .nav-item.active {
    color: #0F5940;
}

.mobile-bottom-nav .nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 3px;
    background: #0F5940;
    border-radius: 0 0 3px 3px;
}

.mobile-bottom-nav .nav-item svg {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
}

.mobile-bottom-nav .nav-item span {
    font-size: 11px;
    font-weight: 600;
}

.mobile-bottom-nav .nav-item .badge {
    position: absolute;
    top: 4px;
    right: 20%;
    background: #EF4444;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Add padding to body to prevent content being hidden behind bottom nav */
@media (max-width: 1024px) {
    body.has-mobile-nav {
        padding-bottom: 64px;
    }
}

/* Hide on desktop */
@media (min-width: 1024px) {
    .mobile-bottom-nav {
        display: none;
    }
}

/* ============================================
   Responsive Tables
   ============================================ */

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-left: -1rem;
    margin-right: -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .table-responsive {
        margin-left: 0;
        margin-right: 0;
        padding-left: 0;
        padding-right: 0;
    }
}

.table-responsive table {
    min-width: 800px;
}

/* Scrollbar styling */
.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #F3F4F6;
    border-radius: 10px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 10px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

/* ============================================
   Mobile-Optimized Stat Cards
   ============================================ */

@media (max-width: 640px) {
    .stat-card {
        padding: 1rem !important;
    }

    .stat-card .icon-container {
        width: 48px !important;
        height: 48px !important;
    }

    .stat-card .icon-container svg {
        width: 24px !important;
        height: 24px !important;
    }

    .stat-card .text-right span {
        font-size: 2rem !important;
    }
}

/* ============================================
   Loading States
   ============================================ */

.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #e0e0e0 50%,
        #f0f0f0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-card {
    padding: 1.5rem;
}

.skeleton-line {
    height: 12px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-circle {
    border-radius: 50%;
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

@media (max-width: 640px) {
    .toast-container {
        left: 1rem;
        right: 1rem;
        top: auto;
        bottom: 80px; /* Above mobile nav */
    }
}

.toast {
    min-width: 300px;
    max-width: 500px;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    pointer-events: all;
    animation: slideInRight 0.3s ease-out;
}

@media (max-width: 640px) {
    .toast {
        min-width: auto;
        width: 100%;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-success {
    background: #10B981;
    color: white;
}

.toast-error {
    background: #EF4444;
    color: white;
}

.toast-warning {
    background: #F59E0B;
    color: white;
}

.toast-info {
    background: #3B82F6;
    color: white;
}

.toast svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.toast .toast-message {
    flex: 1;
    font-weight: 600;
    font-size: 14px;
}

.toast .toast-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.toast .toast-close:hover {
    opacity: 1;
}

/* ============================================
   Enhanced Badges
   ============================================ */

.badge-enhanced {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid;
}

.badge-pending {
    background: #FEF3C7;
    color: #92400E;
    border-color: #FCD34D;
}

.badge-pending .pulse-dot {
    width: 8px;
    height: 8px;
    background: #F59E0B;
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.badge-approved {
    background: #D1FAE5;
    color: #065F46;
    border-color: #6EE7B7;
}

.badge-approved svg {
    width: 16px;
    height: 16px;
    margin-right: 4px;
}

.badge-rejected {
    background: #FEE2E2;
    color: #991B1B;
    border-color: #FCA5A5;
}

.badge-rejected svg {
    width: 16px;
    height: 16px;
    margin-right: 4px;
}

.badge-selected {
    background: #E0E7FF;
    color: #3730A3;
    border-color: #A5B4FC;
}

/* ============================================
   Empty States
   ============================================ */

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state svg {
    width: 96px;
    height: 96px;
    margin: 0 auto 1.5rem;
    color: #D1D5DB;
}

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #374151;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #6B7280;
    margin-bottom: 1.5rem;
}

/* ============================================
   Form Enhancements
   ============================================ */

.form-field-success {
    border-color: #10B981 !important;
}

.form-field-error {
    border-color: #EF4444 !important;
}

.form-field-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.form-help-text {
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.form-help-text.success {
    color: #059669;
}

.form-help-text.error {
    color: #DC2626;
}

.character-count {
    font-size: 0.75rem;
    color: #6B7280;
    text-align: right;
    margin-top: 0.25rem;
}

.character-count.warning {
    color: #F59E0B;
}

.character-count.error {
    color: #EF4444;
}

/* ============================================
   Multi-Step Form Progress
   ============================================ */

.form-progress {
    position: relative;
    margin-bottom: 2rem;
}

.form-progress-line {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background: #E5E7EB;
    z-index: 0;
}

.form-progress-fill {
    height: 100%;
    background: #0F5940;
    transition: width 0.3s ease;
}

.form-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

.form-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.form-step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: 2px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #6B7280;
    transition: all 0.3s ease;
}

.form-step.active .form-step-circle {
    background: #0F5940;
    border-color: #0F5940;
    color: white;
    box-shadow: 0 0 0 4px rgba(15, 89, 64, 0.1);
}

.form-step.completed .form-step-circle {
    background: #10B981;
    border-color: #10B981;
    color: white;
}

.form-step-label {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6B7280;
}

.form-step.active .form-step-label {
    color: #0F5940;
}

@media (max-width: 640px) {
    .form-step-label {
        font-size: 0.625rem;
    }

    .form-step-circle {
        width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }
}

/* ============================================
   Utility Classes
   ============================================ */

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.slide-in-up {
    animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* ============================================
   Improved Scrollbar
   ============================================ */

.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #F3F4F6;
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}
