* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
     -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #2c3e50, #3498db);
    color: white;
    padding: 30px;
    text-align: center;
    position: relative;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 300;
}

.header p {
    opacity: 0.9;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.author-credit {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 10px;
}

.currency-selector {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.currency-selector label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.currency-selector select {
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: #2c3e50;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.currency-selector select:hover {
    background: white;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.main-content {
    display: grid;
    /* CHANGED: Default to a single column for a mobile-first approach */
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
}

.section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.section:hover {
    transform: translateY(-5px);
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}

 .section-title-b {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #c8ccd1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.income-title::before {
    content: "💰";
    font-size: 1.2em;
}

.expense-title::before {
    content: "💸";
    font-size: 1.2em;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.input-group input, .input-group select {
    flex: 1;
    min-width: 150px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.input-group input:focus, .input-group select:focus {
    outline: none;
    border-color: #3498db;
}

.add-btn {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(46, 204, 113, 0.4);
}

.items-list {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 20px;
}

.item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #3498db;
    transition: all 0.3s ease;
}

.item:hover {
    background: #e3f2fd;
    transform: translateX(5px);
}

.item-info {
    flex: 1;
}

.item-name {
    font-weight: 600;
    color: #2c3e50;
}

.item-category {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-top: 2px;
}

.item-amount {
    font-weight: 700;
    color: #27ae60;
    font-size: 1.1rem;
}

.expense-item .item-amount {
    color: #e74c3c;
}

.delete-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.delete-btn:hover {
    background: #c0392b;
    transform: scale(1.05);
}

.summary {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #34495e, #2c3e50);
    color: white;
    text-align: center;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.summary-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 10px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.summary-label {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 5px;
}

.summary-value {
    font-size: 2rem;
    font-weight: 700;
}

.positive {
    color: #2ecc71;
}

.negative {
    color: #e74c3c;
}

.data-controls {
    margin-top: 20px;
}

.clear-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-bottom: 10px;
}

.clear-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.storage-info {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 10px;
}

.categories {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.category-tag {
    background: #ecf0f1;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #2c3e50;
}
/* --- Styling for SEO Content Section --- */
.content-section {
    grid-column: 1 / -1; /* Make it span the full width of the grid */
    background: #f8f9fa;
    color: #2c3e50;
    text-align: left;
}

.content-section h2, .content-section h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: #2c3e50;
}

.content-section h2 {
    text-align: center;
    font-size: 1.8rem;
}

.content-section p, .content-section li {
    line-height: 1.6;
    margin-bottom: 10px;
}

.content-section ol, .content-section ul {
    margin: 0 0 15px 20px;
    padding: 0 0 0 20px;
}

.content-section strong {
    color: #34495e;
}
/* --- Footer Styling --- */
.site-footer {
    text-align: center;
    padding: 25px;
    margin-top: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.site-footer a {
    color: #ffffff;
    font-weight: 500;
    text-decoration: none;
    transition: text-decoration 0.3s ease;
}

.site-footer a:hover {
    text-decoration: underline;
}

/* --- RESPONSIVENESS FIXES --- */

/* For Small Mobiles up to Large Tablets */
@media (max-width: 1023px) {
    .header h1 {
        font-size: 2rem;
    }
    
    .currency-selector {
        position: static;
        justify-content: center;
        margin-top: 15px;
    }
    
    /* On mobile, stack the input fields vertically */
    @media (max-width: 767px) {
        .input-group {
            flex-direction: column;
        }
    }
}

/* For Desktops and large screens */
@media (min-width: 1024px) {
    /* CHANGED: Activate 2-column layout only on screens wider than 1024px */
    .main-content {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
        padding: 30px;
    }

    .summary-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
    }
}

/* For very wide screens */
@media (min-width: 1400px) {
    .container {
        max-width: 1400px;
    }
    
    .main-content {
        gap: 40px;
        padding: 40px;
    }

    /* Ensure input group stays in a single line on very wide screens */
    .input-group {
        flex-wrap: nowrap;
    }
    
    .input-group input[type="text"] {
        flex: 2;
        min-width: 200px;
    }
    
    .input-group input[type="number"] {
        flex: 1;
        min-width: 120px;
        max-width: 150px;
    }
    
    .input-group select {
        flex: 1.2;
        min-width: 140px;
        max-width: 180px;
    }
}