:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --accent-color: #3498db;
    --accent-hover: #2980b9;
    --danger-color: #e74c3c;
    --success-color: #2ecc71;
    --border-color: #404040;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.mui-container {
    max-width: 800px;
    margin: 50px auto;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

h1, h2 {
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.form-section {
    margin-bottom: 30px;
    padding: 20px;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.mui-textfield, .mui-select {
    margin-bottom: 20px;
}

.mui-textfield input, .mui-select select {
    width: 90%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 16px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.3s ease;
}

.mui-textfield input:focus, .mui-select select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.mui-textfield label, .mui-select label {
    color: var(--text-secondary);
    margin-bottom: 5px;
    display: block;
}

.mui-btn {
    background: rgba(147, 112, 219, 0.2);
    color: #9370DB;
    border: 1px solid rgba(147, 112, 219, 0.3);
    transition: all 0.3s ease;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-block;
    font-weight: 500;
}

.mui-btn:hover {
    background: rgba(147, 112, 219, 0.3);
    border-color: rgba(147, 112, 219, 0.5);
}

.mui-btn.mui-btn-secondary {
    background-color: var(--bg-secondary);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
}

.mui-btn.mui-btn-secondary:hover {
    background-color: var(--accent-color);
    color: white;
}

.filter-section {
    margin-top: 30px;
}

.filter-toggle, .graph-toggle {
    background: none;
    border: none;
    color: var(--accent-color);
    text-decoration: underline;
    cursor: pointer;
    margin-bottom: 10px;
    font-size: 16px;
    padding: 8px 16px;
    transition: color 0.3s ease;
    width: 100%;
    text-align: left;
}

.filter-toggle:hover, .graph-toggle:hover {
    color: var(--accent-hover);
}

.filter-content, .graph-content {
    display: none;
    margin-top: 10px;
    padding: 15px;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.expense-list {
    margin-top: 30px;
}

.expense-list ul {
    list-style: none;
    padding: 0;
}

.expense-list li {
    background: var(--bg-primary);
    margin-bottom: 10px;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease;
}

.expense-list li:hover {
    transform: translateX(5px);
}

.graphs-section {
    margin-top: 40px;
}

.graph-container {
    margin-bottom: 25px;
}

canvas {
    width: 100% !important;
    height: 300px !important;
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 10px;
}

.recurring-badge {
    display: inline-block;
    padding: 2px 6px;
    margin-left: 8px;
    background-color: #4CAF50;
    color: white;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: nowrap;
}

.autocomplete-container {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-top: 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: none;
    width: 80%;
}

.autocomplete-dropdown.show {
    display: block;
}

.autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.autocomplete-item:hover {
    background-color: #f5f5f5;
}

.autocomplete-item.selected {
    background-color: #e0e0e0;
}

.amount-badge {
    background-color: #2196F3;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: nowrap;
    margin-left: auto;
}

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

.total-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.total-card h3 {
    margin: 0 0 15px 0;
    color: #e0e0e0;
    font-size: 1.2em;
}

.total-amount {
    font-size: 1.8em;
    font-weight: bold;
    margin-bottom: 10px;
}

.total-amount.primary {
    color: #c51e00;
}

.total-amount.secondary {
    font-size: 1.2em;
    color: #95a5a6;
}

.total-amount.recurring {
    color: #f1c40f;
}

.total-amount.onetime {
    color: #e74c3c;
}

.total-amount.income {
    color: #2ecc71;
}

.total-amount.remaining {
    color: #278f35;
}

.percentage {
    font-size: 1em;
    color: #95a5a6;
}

.header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
    gap: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
    color: #e0e0e0;
    overflow: hidden;
    flex: 1;
    min-width: 250px;
}

.income-info {
    background: rgba(147, 112, 219, 0.1);
    padding: 8px 16px;
    border-radius: 4px;
    color: #9370DB;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    max-width: 300px;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    opacity: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.income-info::before {
    content: "💰";
    position: absolute;
    left: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.income-info.collapsed {
    width: 40px;
    padding: 8px;
    background: rgba(147, 112, 219, 0.05);
}

.income-info.collapsed::before {
    opacity: 1;
}

.income-info.collapsed span {
    opacity: 0;
}

.message {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    color: #e0e0e0;
}

.message a {
    color: #3498db;
    text-decoration: none;
}

.message a:hover {
    text-decoration: underline;
}

.message.error {
    background: rgba(231, 76, 60, 0.2);
    border-left: 4px solid #e74c3c;
}

.edit-income-btn {
    padding: 2px 6px;
    margin-left: 8px;
    opacity: 0.6;
    transition: opacity 0.3s ease;
    background: none;
    border: none;
    cursor: pointer;
}

.edit-income-btn:hover {
    opacity: 1;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: #1a1a1a;
    padding: 24px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    border: 1px solid rgba(147, 112, 219, 0.2);
}

.modal-content h2 {
    margin-top: 0;
    color: #9370DB;
    margin-bottom: 20px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: flex-end;
}

.income-value {
    position: relative;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background-color 0.3s ease;
}

.income-value:hover {
    background: rgba(147, 112, 219, 0.1);
}

.status-message {
    margin-top: 10px;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 0.9em;
}

.status-message.error {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.status-message.success {
    background: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
}

#sendReportBtn {
    width: 100%;
    margin-top: 10px;
    background: rgba(147, 112, 219, 0.2);
    color: #9370DB;
    border: 1px solid rgba(147, 112, 219, 0.3);
    transition: all 0.3s ease;
}

#sendReportBtn:hover {
    background: rgba(147, 112, 219, 0.3);
    border-color: rgba(147, 112, 219, 0.5);
}

#sendReportBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@media screen and (max-width: 768px) {
    .header-section {
        flex-direction: column;
        align-items: stretch;
        gap: 20px;
        padding: 15px;
    }

    .user-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .income-info {
        max-width: 100%;
        font-size: 0.9em;
    }

    .mui-container {
        margin: 20px auto;
        padding: 15px;
    }

    h1 {
        font-size: 1.8em;
    }

    h2 {
        font-size: 1.5em;
    }
}

@media screen and (max-width: 480px) {
    .header-section {
        padding: 10px;
    }

    .income-info {
        font-size: 0.85em;
        padding: 6px 12px;
    }

    h1 {
        font-size: 1.6em;
    }

    h2 {
        font-size: 1.3em;
    }

    .mui-container {
        margin: 10px auto;
        padding: 10px;
    }
}

 /* Tooltip container */
 .tooltip {
    position: relative;
    display: inline-block;
    cursor: pointer;
  }

  /* Tooltip text */
  .tooltip .tooltiptext {
    visibility: hidden;
    width: 220px;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 4px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%; /* Position above the button */
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
  }

  /* Tooltip arrow */
  .tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%; /* At the bottom of the tooltip */
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #555 transparent transparent transparent;
  }

  /* Show the tooltip text when hovering */
  .tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
  }