/* Modern Minimal Design for Shrestha Kirana Store */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1a2e1a;
    --primary-light: #2d4a2d;
    --primary-dark: #0f1a0f;
    --accent-color: #10b981;
    --income-color: #10b981;
    --expense-color: #ef4444;
    --bg-color: #fafafa;
    --card-bg: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg-color);
}

/* Modern Header with Banner */
.header {
    color: white;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--card-bg);
}

.header-banner {
    width: 100%;
    overflow: hidden;
}

.banner-image {
    width: 100%;
    height: 265px;
    object-fit: cover;
    object-position: center;
    display: block;
}

.header-balance {
    display: flex;
    justify-content: center;
    gap: 3rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    padding: 1.25rem 2rem;
}

.balance-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.balance-label {
    font-size: 0.75rem;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.balance-amount {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 0.25rem;
    letter-spacing: -0.02em;
}

/* Minimalist Navigation Tabs */
.nav-tabs {
    display: flex;
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    border-bottom: 1px solid var(--border-color);
}

.nav-tab {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.nav-tab:hover {
    background: var(--bg-color);
    color: var(--text-primary);
}

.nav-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: transparent;
}

.tab-icon {
    font-size: 1.25rem;
}

/* Main Content */
.main-content {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

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

/* Modern Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.summary-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: all 0.2s ease;
}

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

.summary-card.income {
    border-left: 3px solid var(--income-color);
}

.summary-card.expense {
    border-left: 3px solid var(--expense-color);
}

.card-icon {
    font-size: 2.5rem;
    opacity: 0.9;
}

.card-content h3 {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.card-amount {
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Today's Section */
.todays-summary {
    margin-bottom: 2rem;
}

.clickable-card {
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.clickable-card:active {
    transform: translateY(-2px);
}

/* Modal Large */
.modal-large {
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    max-height: 60vh;
    overflow-y: auto;
}

#todaysTransactionsList .transaction-item {
    margin-bottom: 0.75rem;
}

/* Transaction Details Modal */
.transaction-details {
    padding: 1rem 0;
}

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

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.detail-value {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
    text-align: right;
}

.detail-value.income {
    color: var(--income-color);
}

.detail-value.expense {
    color: var(--expense-color);
}

.detail-icon {
    font-size: 2.5rem;
    text-align: center;
    padding: 1rem 0;
}

.transaction-detail-actions {
    display: flex;
    gap: 1rem;
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.transaction-detail-actions button {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

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

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* Chart Section */
.chart-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.chart-section h2 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.month-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.month-selector button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.month-selector button:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.month-selector span {
    font-weight: 600;
    min-width: 150px;
    text-align: center;
    color: var(--text-primary);
}

#expenseChart {
    width: 100%;
    max-height: 300px;
}

/* Transactions */
.transactions-header {
    margin-bottom: 1.5rem;
}

.transactions-header h2 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.filter-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-controls select,
.filter-controls input {
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    background: var(--card-bg);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.filter-controls select:focus,
.filter-controls input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 46, 26, 0.1);
}

.transaction-item {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
    cursor: pointer;
}

.transaction-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.transaction-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.transaction-icon {
    font-size: 1.5rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--bg-color);
}

.transaction-details h4 {
    font-size: 0.9375rem;
    margin-bottom: 0.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.transaction-details p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.transaction-amount {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.transaction-amount.income {
    color: var(--income-color);
}

.transaction-amount.expense {
    color: var(--expense-color);
}

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

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    font-size: 1.125rem;
}

.btn-icon:hover {
    background: var(--bg-color);
    transform: scale(1.1);
}

/* Modern Form Styles */
.form-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    max-width: 600px;
    margin: 0 auto;
}

.form-container h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
}

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

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    background: var(--card-bg);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 46, 26, 0.1);
}

.type-selector {
    display: flex;
    gap: 1rem;
}

.type-btn {
    flex: 1;
    padding: 1rem;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.type-btn:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

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

.btn-primary {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    padding: 0.75rem 1.5rem;
    background: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* Category Selector Buttons */
.category-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.category-btn {
    padding: 1rem 0.75rem;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
}

.category-btn:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

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

.category-btn-icon {
    font-size: 1.75rem;
}

.category-btn-name {
    font-size: 0.8125rem;
    font-weight: 600;
}

/* Categories Management */
.categories-section {
    max-width: 800px;
    margin: 0 auto;
}

.add-category-form {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.add-category-form h3 {
    margin-bottom: 1rem;
    font-size: 1.125rem;
    font-weight: 600;
}

.category-form-inline {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.category-form-inline input,
.category-form-inline select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    background: var(--card-bg);
}

.category-form-inline input {
    flex: 1;
    min-width: 150px;
}

.category-form-inline select {
    min-width: 120px;
}

.category-form-inline button {
    padding: 0.75rem 1.5rem;
    white-space: nowrap;
}

.categories-list {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.categories-list h3 {
    margin-bottom: 1rem;
    margin-top: 1.5rem;
    font-size: 1.125rem;
    font-weight: 600;
}

.categories-list h3:first-child {
    margin-top: 0;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.category-item {
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    text-align: center;
    transition: all 0.2s ease;
    position: relative;
}

.category-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.category-item-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.category-item-name {
    font-weight: 600;
    font-size: 0.875rem;
}

.category-delete {
    position: absolute;
    top: 0.375rem;
    right: 0.375rem;
    background: var(--expense-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    opacity: 0;
    transition: all 0.2s ease;
}

.category-item:hover .category-delete {
    opacity: 1;
}

.category-delete:hover {
    transform: scale(1.1);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
    box-shadow: var(--shadow-lg);
}

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

.close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close:hover {
    color: var(--text-primary);
    background: var(--bg-color);
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.modal-buttons button {
    flex: 1;
}

/* Recent Transactions */
.recent-transactions {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.recent-transactions h2 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 600;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.125rem;
}

/* Responsive Design */

/* Sub-navigation tabs within Add New */
.sub-nav-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.sub-nav-tab {
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    position: relative;
}

.sub-nav-tab:hover {
    background: var(--bg-color);
    color: var(--text-primary);
}

.sub-nav-tab.active {
    color: var(--primary-color);
    background: var(--bg-color);
    font-weight: 600;
}

.sub-nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

.sub-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.sub-tab-content.active {
    display: block;
}

/* Mobile adjustments for sub-nav */
@media (max-width: 768px) {
    .sub-nav-tabs {
        gap: 0.25rem;
    }
    
    .sub-nav-tab {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
        flex: 1;
        text-align: center;
    }
}


/* Mobile header banner adjustment */
@media (max-width: 768px) {
    .banner-image {
        height: 150px;
    }
    
    .header-balance {
        padding: 1rem 1.5rem;
        gap: 2rem;
    }
    
    .balance-amount {
        font-size: 1.5rem;
    }
    
    /* Keep Today's cards in same line on mobile */
    .todays-summary {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .todays-summary .summary-card {
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .todays-summary .card-icon {
        font-size: 1.75rem;
    }
    
    .todays-summary .card-content h3 {
        font-size: 0.8rem;
    }
    
    .todays-summary .card-amount {
        font-size: 1.25rem;
    }
}
