/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f8f9fa;
    color: #333;
    line-height: 1.6;
    padding-bottom: 70px; /* Space for bottom nav */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
    min-height: calc(100vh - 70px);
}

/* ===== CARD COMPONENTS ===== */
.card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.12);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,123,255,0.2);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,123,255,0.3);
    background: linear-gradient(135deg, #0056b3, #004085);
}

.btn:active {
    transform: translateY(0);
}

.btn-success { 
    background: linear-gradient(135deg, #28a745, #1e7e34);
    box-shadow: 0 2px 5px rgba(40,167,69,0.2);
}

.btn-success:hover {
    background: linear-gradient(135deg, #1e7e34, #155724);
    box-shadow: 0 4px 12px rgba(40,167,69,0.3);
}

.btn-danger { 
    background: linear-gradient(135deg, #dc3545, #c82333);
    box-shadow: 0 2px 5px rgba(220,53,69,0.2);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c82333, #a71e2a);
    box-shadow: 0 4px 12px rgba(220,53,69,0.3);
}

.btn-warning { 
    background: linear-gradient(135deg, #ffc107, #e0a800);
    color: #000;
    box-shadow: 0 2px 5px rgba(255,193,7,0.2);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #e0a800, #b38f00);
    box-shadow: 0 4px 12px rgba(255,193,7,0.3);
}

.btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== FORM STYLES ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
    background: #fff;
}

.form-control:read-only {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

.form-control:disabled {
    background-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
}

/* ===== STATS & GRIDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(102,126,234,0.3);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    margin: 10px 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.stat-card div:first-child {
    font-size: 14px;
    opacity: 0.9;
    font-weight: 500;
}

/* ===== SEARCH & SORT ===== */
.search-sort {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.search-sort input, 
.search-sort select {
    flex: 1;
    min-width: 200px;
}

.filter-form {
    margin-bottom: 25px;
}

.filter-form .form-group {
    margin-bottom: 15px;
}

/* ===== BENEFICIARY LIST ===== */
.beneficiary-list {
    display: grid;
    gap: 12px;
}

.beneficiary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: white;
    border-radius: 10px;
    border-left: 4px solid #007bff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: all 0.3s ease;
}

.beneficiary-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.beneficiary-info h4 {
    margin-bottom: 8px;
    color: #2c3e50;
    font-size: 18px;
}

.beneficiary-info div {
    font-size: 14px;
    color: #6c757d;
}

/* ===== BADGES ===== */
.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-rvy { 
    background: linear-gradient(135deg, #ffc107, #e0a800);
    color: #000;
}

.badge-adip { 
    background: linear-gradient(135deg, #17a2b8, #138496);
    color: white;
}

.badge-verified { 
    background: linear-gradient(135deg, #28a745, #1e7e34);
    color: white;
}

/* ===== BOTTOM NAVIGATION ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    padding: 10px 15px;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.1);
    border-top: 1px solid #e9ecef;
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 5px;
    font-size: 12px;
    text-decoration: none;
    color: #6c757d;
    transition: all 0.3s ease;
    border-radius: 10px;
    font-weight: 500;
}

.nav-item.active {
    color: #007bff;
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,123,255,0.2);
}

.nav-item:not(.active):hover {
    color: #495057;
    background: #f8f9fa;
}

/* ===== MAIN CONTENT AREA ===== */
.main-content {
    margin-bottom: 90px; /* Extra space for bottom nav */
}

.main-content h2 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 28px;
    font-weight: 700;
}

.main-content p {
    color: #6c757d;
    margin-bottom: 25px;
    font-size: 16px;
}

/* ===== LOGIN STYLES ===== */
.login-container {
    max-width: 400px;
    margin: 80px auto;
    padding: 30px;
}

.login-container h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #2c3e50;
    font-size: 32px;
    font-weight: 300;
}

/* ===== UPLOAD & DOCUMENT STYLES ===== */
.upload-preview {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    margin: 5px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-preview:hover {
    transform: scale(1.05);
    border-color: #007bff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.upload-container {
    margin: 15px 0;
}

.upload-container input[type="file"] {
    border: 2px dashed #dee2e6;
    padding: 20px;
    text-align: center;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.upload-container input[type="file"]:hover {
    border-color: #007bff;
    background: #e3f2fd;
}

/* ===== MODAL STYLES ===== */
#imageModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#modalImage {
    max-width: 90%;
    max-height: 90%;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ===== EXPORT BUTTONS ===== */
.export-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin: 20px 0;
}

/* ===== ALERT MESSAGES ===== */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid transparent;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-color: #28a745;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-color: #dc3545;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-color: #ffc107;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-color: #17a2b8;
}

/* ===== QUICK ACTIONS GRID ===== */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin: 20px 0;
}

/* ===== TABLE STYLES (for exports) ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.data-table th {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    font-weight: 600;
    color: #495057;
}

.data-table tr:hover {
    background: #f8f9fa;
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* ===== LOADING STATES ===== */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .stats-grid,
    .admin-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .search-sort {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-sort input,
    .search-sort select {
        min-width: 100%;
    }
    
    .beneficiary-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 15px;
    }
    
    .beneficiary-item > div:last-child {
        align-self: stretch;
    }
    
    .bottom-nav {
        padding: 8px 10px;
    }
    
    .nav-item {
        font-size: 11px;
        padding: 8px 3px;
    }
    
    .main-content h2 {
        font-size: 24px;
    }
    
    .card {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 13px;
    }
    
    .stat-number {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .stats-grid,
    .admin-grid {
        grid-template-columns: 1fr;
    }
    
    .login-container {
        margin: 40px auto;
        padding: 20px;
    }
    
    .main-content h2 {
        font-size: 22px;
    }
    
    .nav-item {
        font-size: 10px;
    }
    
    .form-control {
        padding: 10px 12px;
        font-size: 14px;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .bottom-nav,
    .btn,
    .search-sort {
        display: none !important;
    }
    
    .container {
        padding: 0;
        margin: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #000;
        margin-bottom: 10px;
    }
    
    body {
        background: white;
        color: black;
        font-size: 12px;
    }
}

/* ===== DARK MODE SUPPORT (Optional) ===== */
@media (prefers-color-scheme: dark) {
    body {
        background: #1a1a1a;
        color: #e9ecef;
    }
    
    .card {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .form-control {
        background: #2d3748;
        border-color: #4a5568;
        color: #e9ecef;
    }
    
    .form-control:focus {
        border-color: #63b3ed;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
.btn:focus,
.form-control:focus,
.nav-item:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid;
    }
    
    .card {
        border: 2px solid;
    }
    
    .form-control {
        border: 2px solid;
    }
}

/* ===== UTILITY CLASSES ===== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.p-0 { padding: 0; }
.p-1 { padding: 10px; }
.p-2 { padding: 20px; }
.p-3 { padding: 30px; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

/* ===== CUSTOM SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}