@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;  
}

body {  
    line-height: 1.6;
    padding: 1rem;
    padding-top: 6rem;
    max-width: 100%;
}

header, footer {
    background-color: #2c3e50;
    color: white;
    padding: 1rem;
    margin-bottom: 1rem;
    text-align: center;
    position: relative;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

header h1 {
    margin: 0;
    flex: 1;
}

@media (min-width: 768px) {
    body { 
        padding: 2rem;
        padding-top: 6rem;
    }
}

@media (min-width: 1024px) {
    body { max-width: 1200px; margin: 0 auto; }
}


#form-section {
    background-color: #e8e8e8;
    padding: 1.5rem; 
    margin: 2rem 0;
    border-radius: 9px;
    border-left: solid 8px #2c3e50;
    border-right: solid 8px #2c3e50;
    box-shadow: 0 3px 4px rgba(0,0,0,0.1);
}

.form-fields {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 590;
    color: #333;
}

input, select, button {
    width: 100%;
    padding: 0.60rem;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

input:focus, select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

button {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 595;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

button:hover, button:focus {
    background: #c0392b;
}

button:active {
    transform: translateY(1.5px);
}

.error-message {
    color: #d32f2f;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    min-height: 1.25rem;
}

input.invalid, select.invalid {
    border-color: #d32f2f;
    background-color: #ffebee;
}

input.valid, select.valid {
    border-color: #27ae60;
}

.form-status {
    margin-top: 1rem;
    padding: 0.60rem;
    border-radius: 5px;
    text-align: center;
}

.form-status.success {
    background: #d5f4e6;
    color: #27ae60;
    border: 1px solid #27ae60;
}

@media (min-width: 768px) {
    .form-fields {
        display: flex;
        flex-direction: column;
    }
   
    #transaction-form {
        max-width: 500px;
        margin: 0 auto;
    }
}

#transactions-section {
    margin: 3rem 0;
}

.search-container {
    position: relative;
    max-width: 400px;
    margin-bottom: 1rem;
}

#search-input {
    padding-right: 2.5rem;
}

#clear-search {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    width: auto;
    padding: 0.25rem;
    cursor: pointer;
    color: #666;
}

#clear-search:hover {
    color: #333;
}

.table-container {
    overflow-x: auto;
    margin: 1rem 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.sortable {
    cursor: pointer;
    user-select: none;
}

.sortable:hover {
    background: #e9ecef;
}

.sort-indicator {
    margin-left: 0.5rem;
    font-size: 0.8em;
}

.sort-asc .sort-indicator::after { content: " ↑"; }
.sort-desc .sort-indicator::after { content: " ↓"; }

.mobile-card {
    display: none;
    background: white;
    padding: 1rem;
    margin: 0.5rem 0;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.mobile-card .card-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.mobile-card .card-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

mark {
    background: yellow;
    color: black;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #666;
}

@media (max-width: 767px) {
    table { display: none; }
    .mobile-card { display: block; }
    
    .search-container {
        max-width: 100%;
    }
}

@media (min-width: 768px) {
    .mobile-card { display: none; }
}


#dashboard-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #ecf0f1;
    border-radius: 8px;
    border-left: solid 8px #2c3e50;
    border-right: solid 8px #2c3e50
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.stat-card {
    background: #e8e8e8;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-card h3 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-number {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c3e50;
}

.budget-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #e8e8e8;
    border-radius: 8px;
}

.budget-input {
    display: grid;
    grid-template-columns: auto minmax(60px, 1fr) auto;
    gap: 0.75rem 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.budget-bar {
    width: 100%;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin: 1rem 0;
}
.budget-input {
    display: grid;
    grid-template-columns: auto minmax(90px, 1fr) auto;
    gap: 0.75rem 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.budget-input label {
    margin: 0;
    padding-right: 0.25rem;
    white-space: nowrap;
}

.budget-input input {
    min-width: 60px;
    width: 100%;
}

#set-budget {
    padding: 0.5rem 1rem;
}

@media (max-width: 1024px) {
    .budget-input { grid-template-columns: auto minmax(50px, 1fr) auto; }
}

.chart-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #e1e1e1;
    border-radius: 8px;
}

.budget-info {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.budget-balance {
    font-weight: 700;
    color: #2c3e50;
}

.budget-balance.positive { color: #2e7d32; }
.budget-balance.negative { color: #c62828; }

.trend-chart {
    display: flex;
    align-items: end;
    gap: 0.5rem;
    height: 150px;
    margin-top: 1rem;
}

.chart-bar {
    flex: 1;
    background: #3498db;
    border-radius: 4px 4px 0 0;
    position: relative;
    transition: height 0.3s ease;
}

.chart-bar:hover {
    background: #2980b9;
}

.chart-label {
    position: absolute;
    bottom: -25px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.8rem;
    color: #666;
}

@media (max-width: 767px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .budget-input {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    #set-budget {
        width: 100%;
    }
}


#settings-section {
    margin: 3rem 0;
}

.settings-grid {
    display: grid;
    gap: 2rem;
}

.setting-group {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: solid 8px #2c3e50;
    border-right: solid 8px #2c3e50;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.setting-group h3 {
    margin: 0 0 1rem 0;
    color: #333;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 0.5rem;
}

#shortcuts-doc kbd {
    background: #222;
    color: #fff;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9rem;
}

#shortcuts-doc ul { margin-left: 1rem; }

.currency-inputs {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

.data-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-secondary {
    background: #6c757d;
    width: auto;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    width: auto;
}

.btn-danger:hover {
    background: #c82333;
}

@media (max-width: 767px) {
    .data-actions {
        flex-direction: column;
    }
    
    .data-actions button {
        width: 100%;
    }
}


.dropdown-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-toggle {
    background: #3498db;
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.theme-toggle { background: none; border: none; cursor: pointer; font-size: 1.1rem; }
.theme-toggle:hover { background: transparent; }

.dropdown-toggle:hover {
    background: #2980b9;
}

.dropdown-toggle:active {
    transform: translateY(1px);
}

.dropdown-toggle[aria-expanded="true"] {
    background: #21618c;
}

.menu-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.menu-text {
    display: none;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    list-style: none;
    padding: 0.5rem 0;
    margin: 0.5rem 0 0 0;
    min-width: 200px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}
    
.dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    margin: 0;
}

.dropdown-menu a {
    display: block;
    padding: 0.75rem 1rem;
    color: #333;
    text-decoration: none;
    transition: background-color 0.2s ease;
    border-radius: 0;
}

.dropdown-menu a:hover,
.dropdown-menu a:focus {
    background: #f8f9fa;
    outline: none;
}

.dropdown-menu a[aria-current="page"] {
    background: #3498db;
    color: white;
}

.dropdown-menu a[aria-current="page"]:hover {
    background: #2980b9;
}

@media (max-width: 767px) {
    .menu-text {
        display: inline;
    }
    
    .dropdown-menu {
        min-width: 180px;
        right: 0;
        left: auto;
    }
}

@media (min-width: 768px) {
    .menu-text {
        display: inline;
    }
    
    .dropdown-toggle {
        padding: 0.75rem 1.25rem;
    }
}


.page-section {
    display: none !important;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.page-section.active {
    display: block !important;
    opacity: 1;
    transform: translateY(0);
}

.page-section.fade-in {
    animation: pageFadeIn 0.5s ease-out;
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-loading {
    position: relative;
}

.page-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

button:focus, input:focus, select:focus, a:focus {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.stat-card, .setting-group {
    animation: fadeIn 1.7s ease-out;
}


#about-section {
    max-width: 700px;
    margin: 0 auto;
    padding: 2rem;
}

#about-section h2 {
    color: #2c3e50;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

#about-section h3 {
    color: #3498db;
    font-size: 1.3rem;
    margin: 1.5rem 0 1rem 0;
}

#about-section p {
    line-height: 1.6;
    margin-bottom: 1rem;
    color: #333;
}

.about-content {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.feature-highlight {
    background: #e3f2fd;
    padding: 1rem 1.7rem;
    border-radius: 7px;
    border: 1px solid #bbdefb;
    border-left: solid 8px #3498db;
    border-right: solid 8px #3498db;
    margin: 1rem 0;
}

.contact-info {
    background: #f8f9fa;
    padding: 1.5rem;
    padding-left: 2.2rem;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.contact-info h3 {
    margin-top: 0;
    color: #2c3e50;
}

.contact-info p {
    margin-bottom: 0.8rem;
}

.contact-info a {
    color: #3498db;
    text-decoration: none;
    font-weight: 600;
}

.contact-info a:hover {
    color: #2980b9;
    text-decoration: underline;
}

html.dark {
    color-scheme: dark;
}

html.dark body {
    background: #0f1720;
    color: #e6eef6;
}

html.dark header, html.dark .stat-card, html.dark .setting-group, html.dark .about-content, html.dark .feature-highlight, html.dark .contact-info, html.dark .chart-section, html.dark #form-section {
    background: #0b1220;
    color: #dbeafe;
    border-color: rgba(255,255,255,0.06);
}

html.dark header {
    background: #071021;
}

html.dark button, html.dark .dropdown-toggle {
    background: #1f6aa5;
    color: #f4fbff;
}

html.dark .dropdown-menu {
    background: #071021;
    color: #dbeafe;
    border-color: rgba(255,255,255,0.06);
}

html.dark table { background: #071021; color: #dbeafe; }
html.dark th { background-color: transparent; color: #c8def8; }
html.dark td { border-color: rgba(255,255,255,0.03); }

html.dark .chart-bar { background-color: #7dd3fc; }
html.dark .chart-bar:hover { background-color: #38bdf8; }

html.dark a { color: #93c5fd; }