/* ==================== GLOBAL RESET ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

/* ==================== MAIN CONTAINER ==================== */
.container {
    max-width: 1200px;
    width: 100%;
    margin: 90px auto 0;   /* हेडर की ऊँचाई के नीचे जगह */
    padding: 0 16px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
    position: relative;
}

/* ==================== हैमबर्गर हेडर (टॉप फिक्स्ड) ==================== */
.header {
    background: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 70px;
    width: 100%;
}

.hamburger {
    font-size: 28px;
    cursor: pointer;
    background: none;
    border: none;
    color: #2d4059;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.hamburger:hover {
    background: #f0f4f8;
}

/* ==================== मेनू कंटेनर (टॉप स्लाइडिंग) ==================== */
.menu-container {
    position: fixed;
    top: -100vh;          /* ऊपर से पूरी तरह छिपा */
    left: 0;
    width: 100%;
    background: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    transition: top 0.3s ease;
    z-index: 999;
    max-height: 80vh;
    overflow-y: auto;
    border-radius: 0 0 20px 20px;
    padding: 20px 0;
}

.menu-container.open {
    top: 70px;             /* हेडर की ऊँचाई के ठीक नीचे खुले */
}

.menu-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid #eef2f6;
    margin-bottom: 20px;
}

.menu-header h2 {
    margin: 0;
    font-size: 22px;
    color: #2d4059;
}

.menu-nav {
    display: flex;
    flex-direction: column;
}

.menu-nav a {
    padding: 16px 24px;
    text-decoration: none;
    color: #2d4059;
    font-size: 18px;
    font-weight: 500;
    transition: 0.2s;
    border-left: 4px solid transparent;
}

.menu-nav a:hover,
.menu-nav a.active {
    background: #f0f7ff;
    border-left-color: #2d4059;
}

/* ==================== ओवरले (बैकड्रॉप) ==================== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 998;
    display: none;
}

.overlay.show {
    display: block;
}

/* ==================== टाइपोग्राफी ==================== */
h1 {
    text-align: center;
    padding: 25px;
    background: linear-gradient(135deg, #ff6b6b, #feca57);
    color: white;
    font-size: 26px;
}

h2, h3, h4 {
    color: #333;
}

/* ==================== फॉर्म एलिमेंट्स ==================== */
input, select, textarea, button {
    max-width: 100%;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s;
}

input, select, textarea {
    width: 100%;
    padding: 14px;
    margin: 8px 0;
    border: 2px solid #e9ecef;
}

input:focus, select:focus, textarea:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea {
    height: 90px;
    resize: vertical;
}

button {
    padding: 12px 20px;
    margin: 8px 0;
    border: none;
    font-weight: bold;
    cursor: pointer;
    color: white;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

button:active {
    transform: translateY(0);
}

/* ==================== बटन रंग ==================== */
.login-btn { background: linear-gradient(135deg, #28a745, #20c997); width: 100%; }
.signup-btn { background: linear-gradient(135deg, #007bff, #0056b3); width: 100%; }
.expense-btn { background: linear-gradient(135deg, #dc3545, #c82333); }
.funding-btn { background: linear-gradient(135deg, #28a745, #20c997); }
.update-btn { background: linear-gradient(135deg, #007bff, #0056b3); }
.cancel-btn { background: linear-gradient(135deg, #6c757d, #495057); }
.export-btn { background: linear-gradient(135deg, #007bff, #0056b3); }
.import-btn { background: linear-gradient(135deg, #ff9800, #ff5722); }
.backup-btn { background: linear-gradient(135deg, #9c27b0, #673ab7); }
.clear-btn { background: linear-gradient(135deg, #6c757d, #495057); }
.category-manage-btn { background: linear-gradient(135deg, #9c27b0, #673ab7); }
.logout-btn { background: #dc3545; padding: 10px 16px; font-size: 14px; border-radius: 8px; }
.refresh-btn { background: linear-gradient(135deg, #17a2b8, #138496); padding: 10px 16px; font-size: 14px; border-radius: 8px; }
.save-btn { background: linear-gradient(135deg, #ff9800, #ff5722); padding: 10px 16px; font-size: 14px; border-radius: 8px; }

/* ==================== हिडेन क्लास ==================== */
.hidden { display: none !important; }

/* ==================== लोडिंग स्पिनर ==================== */
.spinner-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.spinner-text {
    color: white;
    font-size: 18px;
    font-weight: bold;
}

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

/* ==================== लिस्ट सेक्शन ==================== */
.list-section {
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
}

.date-group {
    margin-bottom: 25px;
}

.date-header {
    background: linear-gradient(135deg, #2196f3, #21cbf3);
    color: white;
    padding: 16px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.item {
    padding: 18px;
    margin: 10px 0;
    border-radius: 12px;
    background: #f9f9f9;
    border-left: 6px solid #333;
    font-size: 16px;
    transition: transform 0.2s;
    word-wrap: break-word;
    overflow: hidden;
}

.item:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.expense-item {
    background: #ffebee;
    border-left-color: #f44336;
}

.funding-item {
    background: #e8f5e8;
    border-left-color: #4caf50;
}

.item-details {
    font-size: 14px;
    color: #555;
    margin-top: 8px;
    font-style: italic;
}

/* ==================== समरी कार्ड ==================== */
.summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
}

.summary-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    font-size: 16px;
    transition: transform 0.3s;
}

.summary-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.summary-value {
    font-size: 24px;
    font-weight: bold;
    margin-top: 8px;
}

.profit { color: #28a745; }
.loss { color: #dc3545; }

/* ==================== क्विक स्टैट्स ==================== */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    padding: 15px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 12px;
    margin: 15px;
}

.quick-stat {
    text-align: center;
    padding: 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
}

.quick-stat span:first-child {
    display: block;
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 5px;
}

.quick-stat span:last-child {
    font-weight: bold;
    font-size: 18px;
}

/* ==================== कैटेगरी टोटल ==================== */
.category-total {
    background: linear-gradient(135deg, #17a2b8, #138496);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin: 20px;
    box-shadow: 0 6px 18px rgba(23, 162, 184, 0.3);
}

.cat-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.3);
    font-size: 18px;
    transition: all 0.3s;
}

/* ==================== यूजर इन्फो ==================== */
.user-info {
    text-align: right;
    padding: 15px 25px;
    background: #f8f9fa;
    font-size: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #e9ecef;
    flex-wrap: wrap;
    gap: 10px;
}

.user-stats {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

/* ==================== व्यू सेक्शन ==================== */
.view-section {
    display: none;
    padding: 20px;
    margin: 20px 0;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    background: white;
    width: 100%;
}

.view-section.active {
    display: block;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(0,0,0,0.1);
    flex-wrap: wrap;
    gap: 10px;
}

.close-view-btn {
    background: #6c757d;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    color: white;
    cursor: pointer;
    border: none;
}

.close-view-btn:hover {
    background: #5a6268;
}

/* ==================== डैशबोर्ड ग्रिड ==================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.dashboard-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    word-wrap: break-word;
}

.dashboard-card.full-width {
    grid-column: 1 / -1;
}

.dashboard-card h4 {
    margin-bottom: 15px;
    color: #333;
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
}

/* ==================== डेली स्टैट्स ==================== */
.daily-stats {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 15px;
}

.daily-stat {
    flex: 1;
    min-width: 100px;
    text-align: center;
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.daily-stat-value {
    font-size: 24px;
    font-weight: bold;
    margin-top: 5px;
}

/* ==================== कैटेगरी वाइज समरी ==================== */
#categoryWiseSummary {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

#categorySummaryContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.category-wise-item {
    width: 100%;
    max-width: 100%;
    margin: 10px auto;
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    word-wrap: break-word;
}

/* ==================== मंथली समरी ==================== */
#monthlySummary {
    background: linear-gradient(135deg, #9c27b0, #673ab7);
    color: white;
}

.monthly-item {
    background: rgba(255,255,255,0.1);
    padding: 15px;
    margin: 10px 0;
    border-radius: 10px;
    transition: all 0.3s;
}

.monthly-item:hover {
    background: rgba(255,255,255,0.2);
    transform: translateX(5px);
}

/* ==================== ट्रांजैक्शन सेक्शन ==================== */
#transactionsSection {
    background: white;
    color: #333;
}

/* ==================== चार्ट्स सेक्शन ==================== */
#chartsSection {
    background: white;
}

.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

.chart-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.chart-card h4 {
    margin-bottom: 15px;
    color: #333;
    text-align: center;
}

.chart-card canvas {
    width: 100% !important;
    height: 250px !important;
}

/* ==================== पैजिनेशन ==================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.pagination button {
    padding: 8px 16px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.pagination button:hover {
    background: #0056b3;
}

.pagination button:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

#pageInfo {
    font-weight: bold;
    color: #333;
}

/* ==================== सर्च और फिल्टर ==================== */
.search-container {
    margin: 16px 0;
}

.filter-container {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.filter-container select {
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
    min-width: 150px;
}

/* ==================== टोस्ट नोटिफिकेशन ==================== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    color: white;
    border-radius: 12px;
    z-index: 1000;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
    max-width: 350px;
    display: flex;
    align-items: center;
    gap: 10px;
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}

.toast-success { background: linear-gradient(135deg, #28a745, #20c997); }
.toast-error { background: linear-gradient(135deg, #dc3545, #c82333); }
.toast-info { background: linear-gradient(135deg, #007bff, #0056b3); }
.toast-warning { background: linear-gradient(135deg, #ff9800, #ff5722); color: #333; }

/* ==================== मोडल ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close-btn {
    background: #dc3545;
    padding: 8px 16px;
    border-radius: 8px;
    color: white;
    border: none;
    cursor: pointer;
}

.close-btn:hover {
    background: #c82333;
}

/* ==================== कैटेगरी प्रबंधन ==================== */
.category-type-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.category-type-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    background: #e9ecef;
    color: #333;
    transition: all 0.3s;
}

.category-type-btn.active {
    background: linear-gradient(135deg, #2196f3, #21cbf3);
    color: white;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.custom-category-list {
    margin-top: 20px;
}

.custom-category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    margin: 8px 0;
    border-radius: 10px;
}

.custom-category-item:hover {
    background: #e9ecef;
}

.delete-category-btn {
    background: #dc3545;
    padding: 6px 12px;
    border-radius: 6px;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 12px;
}

.delete-category-btn:hover {
    background: #c82333;
}

/* ==================== एक्शन बटन ==================== */
.action-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.action-buttons button {
    padding: 8px 12px;
    font-size: 14px;
    border-radius: 6px;
    border: none;
    color: white;
    cursor: pointer;
}

.edit-btn { background: linear-gradient(135deg, #007bff, #0056b3); }
.delete-btn { background: linear-gradient(135deg, #dc3545, #c82333); }

/* ==================== पासवर्ड टॉगल ==================== */
.password-container {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #666;
    width: auto;
    padding: 0;
}

.toggle-password:hover {
    color: #333;
}

/* ==================== ऑथ इन्फो ==================== */
.auth-info {
    background: #e7f3ff;
    padding: 12px;
    border-radius: 10px;
    margin: 12px 0;
    text-align: left;
    font-size: 14px;
    border-left: 4px solid #2196f3;
}

.auth-info h3 {
    margin: 0 0 8px 0;
    color: #2196f3;
}

.auth-info ul {
    margin: 8px 0;
    padding-left: 20px;
}

.auth-info li {
    margin: 4px 0;
}

/* ==================== डेमो इन्फो ==================== */
.demo-info {
    text-align: left;
    border-left: 4px solid #28a745;
}

/* ==================== व्यू टॉगल बटन (यदि कहीं उपयोग हो) ==================== */
.view-toggle-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.view-toggle-btn {
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
    padding: 12px 15px;
    border-radius: 10px;
    border: none;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    flex: 1 1 auto;
    min-width: 80px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}

.view-toggle-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.2);
}

.view-toggle-btn.active {
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    transform: translateY(-2px);
}

/* ==================== ट्रांजैक्शन यूजर इन्फो ==================== */
.transaction-user {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.transaction-user span {
    color: #2196f3;
    font-weight: bold;
}

/* ==================== टाइप बैज ==================== */
.type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.badge-expense {
    background: #ffebee;
    color: #dc3545;
}

.badge-income {
    background: #e8f5e8;
    color: #28a745;
}

/* ==================== रिस्पॉन्सिव डिजाइन ==================== */
@media (max-width: 768px) {
    .container {
        margin: 80px 10px 10px;
        padding: 0 10px;
    }
    
    .header {
        padding: 12px 16px;
        height: 62px;
    }
    
    .menu-container.open {
        top: 62px;
    }
    
    .summary {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 15px;
    }
    
    .summary-card {
        padding: 15px;
    }
    
    .summary-value {
        font-size: 18px;
    }
    
    .filter-container {
        flex-direction: column;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .user-info {
        flex-direction: column;
        text-align: center;
    }
    
    .daily-stats {
        flex-direction: column;
    }
    
    .daily-stat {
        min-width: 100%;
    }
    
    .view-toggle-buttons {
        flex-direction: column;
    }
    
    .view-toggle-btn {
        min-width: 100%;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .charts-container {
        grid-template-columns: 1fr;
    }
    
    .quick-stats {
        grid-template-columns: 1fr;
    }
    
    .quick-stat {
        min-width: 100%;
    }
}

/* ==================== एडमिन लिंक (यदि उपयोग हो) ==================== */
.admin-link {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.admin-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    background: linear-gradient(135deg, #34495e, #2c3e50);
}

.admin-link.hidden {
    display: none;
}