:root {
    --primary-color: #1FAB89;
    --secondary-color: #62D2A2;
    --tertiary-color: #9DF3C4;
    --light-color: #D7FBE8;
    --accent-color: #FF6B9D;
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
    --background: #f8f9fa;
    --white: #ffffff;
    --border-color: #e9ecef;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--background);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    padding: 1rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h1 {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.health-score {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.score-label {
    font-size: 0.75rem;
    opacity: 0.9;
}

.score-value {
    font-size: 1.25rem;
    font-weight: bold;
    padding: 0.25rem 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    min-width: 60px;
    text-align: center;
}

/* Navigation */
.main-nav {
    background: var(--white);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.nav-btn {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    color: var(--text-light);
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    border-radius: 8px;
}

.nav-btn i {
    font-size: 1.25rem;
}

.nav-btn:hover,
.nav-btn.active {
    color: var(--primary-color);
    background: var(--light-color);
}

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

.content-section {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

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

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

/* Dashboard Cards */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

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

.card-header {
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: bold;
}

.card-content {
    padding: 1rem;
}

.bills-preview {
    max-height: 200px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.bills-preview::-webkit-scrollbar {
    width: 4px;
}

.bills-preview::-webkit-scrollbar-track {
    background: transparent;
}

.bills-preview::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.bill-preview-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.bill-preview-item:last-child {
    border-bottom: none;
}

.bill-preview-info {
    flex: 1;
}

.bill-preview-name {
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.bill-preview-date {
    font-size: 0.875rem;
    color: var(--text-light);
}

.bill-preview-amount {
    font-weight: bold;
    color: var(--primary-color);
}

.urgent-bills .bill-preview-amount {
    color: var(--accent-color);
}

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

.summary-item:last-child {
    border-bottom: none;
}

.summary-label {
    color: var(--text-light);
}

.summary-value {
    font-weight: bold;
    color: var(--text-dark);
}

.summary-value.paid {
    color: var(--primary-color);
}

.summary-value.pending {
    color: var(--accent-color);
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.quick-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow);
}

.quick-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-header h2 {
    color: var(--text-dark);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

.btn-secondary {
    background: var(--white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

.btn-danger {
    background: var(--accent-color);
    color: var(--white);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

/* Bills Timeline */
.bills-filters {
    margin-bottom: 1rem;
}

.filter-select {
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    color: var(--text-dark);
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    max-width: 300px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(31, 171, 137, 0.1);
}

.bills-timeline {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.bill-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.bill-item:last-child {
    border-bottom: none;
}

.bill-item:hover {
    background: var(--light-color);
}

.bill-item.overdue {
    border-left: 4px solid var(--accent-color);
    background: linear-gradient(90deg, rgba(255, 107, 157, 0.1), transparent);
}

.bill-item.due-soon {
    border-left: 4px solid #ffa726;
    background: linear-gradient(90deg, rgba(255, 167, 38, 0.1), transparent);
}

.bill-item.paid {
    opacity: 0.7;
    border-left: 4px solid var(--primary-color);
    background: linear-gradient(90deg, rgba(31, 171, 137, 0.1), transparent);
}

.bill-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.25rem;
    margin-right: 1rem;
    flex-shrink: 0;
}

.bill-info {
    flex: 1;
    min-width: 0;
}

.bill-name {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.bill-details {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

.bill-amount {
    font-weight: bold;
    font-size: 1.125rem;
    color: var(--primary-color);
    margin-right: 1rem;
}

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

.bill-action-btn {
    background: none;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-light);
}

.bill-action-btn:hover {
    background: var(--light-color);
    color: var(--primary-color);
}

.bill-action-btn.pay-btn:hover {
    background: var(--primary-color);
    color: var(--white);
}

.bill-action-btn.delete-btn:hover {
    background: var(--accent-color);
    color: var(--white);
}

/* Cashflow Section */
.cashflow-scenarios {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.scenario-tabs {
    display: flex;
    background: var(--light-color);
}

.scenario-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-light);
}

.scenario-tab.active {
    background: var(--white);
    color: var(--primary-color);
    box-shadow: inset 0 -3px 0 var(--primary-color);
}

.cashflow-chart {
    padding: 2rem;
    position: relative;
    min-height: 400px;
}

.flowing-water {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(90deg, var(--tertiary-color), var(--secondary-color), var(--primary-color));
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 2rem;
}

.water-flow {
    width: 200%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.3) 25%, 
        rgba(255, 255, 255, 0.5) 50%, 
        rgba(255, 255, 255, 0.3) 75%, 
        transparent 100%);
    animation: flowWater 3s linear infinite;
}

@keyframes flowWater {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(0);
    }
}

.cashflow-projection {
    margin-top: 120px;
}

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

.projection-item:last-child {
    border-bottom: none;
}

.projection-month {
    font-weight: 600;
    color: var(--text-dark);
}

.projection-amount {
    font-weight: bold;
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

.projection-amount.positive {
    background: var(--light-color);
    color: var(--primary-color);
}

.projection-amount.negative {
    background: rgba(255, 107, 157, 0.1);
    color: var(--accent-color);
}

/* Settings */
.settings-groups {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.settings-group {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.settings-group h3 {
    color: var(--text-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.setting-item:last-child {
    border-bottom: none;
}

.setting-item label {
    font-weight: 500;
    color: var(--text-dark);
}

.setting-item input[type="number"] {
    background: var(--background);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    width: 80px;
    text-align: center;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 24px;
    appearance: none;
    background: var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.toggle-switch:checked {
    background: var(--primary-color);
}

.toggle-switch::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--white);
    top: 2px;
    left: 2px;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch:checked::before {
    transform: translateX(26px);
}

/* FAQ Section */
.faq-section {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    margin: 2rem 0;
}

.faq-section h2 {
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    text-align: center;
}

.faq-container {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    border-bottom: 1px solid var(--border-color);
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-question {
    width: 100%;
    background: none;
    border: none;
    padding: 1.5rem 0;
    text-align: left;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.faq-question:hover {
    color: var(--primary-color);
}

.faq-icon {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--primary-color);
    transition: var(--transition);
}

.faq-question[aria-expanded="true"] .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    padding: 0 0 1.5rem 0;
    color: var(--text-light);
    line-height: 1.6;
    animation: fadeInDown 0.3s ease-out;
}

.faq-answer[hidden] {
    display: none;
}

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

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

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

.modal-content {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-hover);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
}

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

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
    background: var(--white);
}

.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(31, 171, 137, 0.1);
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: auto !important;
    margin: 0;
}

.checkmark {
    position: relative;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    transition: var(--transition);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--white);
    font-weight: bold;
    font-size: 12px;
}

/* Batch Payment */
.batch-bills-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.batch-bill-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.batch-bill-item:last-child {
    border-bottom: none;
}

.batch-bill-item input[type="checkbox"] {
    margin-right: 1rem;
    width: auto;
}

.batch-bill-info {
    flex: 1;
}

.batch-bill-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.batch-bill-date {
    font-size: 0.875rem;
    color: var(--text-light);
}

.batch-bill-amount {
    font-weight: bold;
    color: var(--primary-color);
}

.batch-summary {
    background: var(--light-color);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

/* Confetti Animation */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--primary-color);
    animation: confettiFall 3s linear forwards;
}

.confetti-piece:nth-child(2n) {
    background: var(--secondary-color);
}

.confetti-piece:nth-child(3n) {
    background: var(--accent-color);
}

.confetti-piece:nth-child(4n) {
    background: var(--tertiary-color);
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-hover);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    animation: slideInRight 0.3s ease-out;
    border-left: 4px solid var(--primary-color);
}

.toast.success {
    border-left-color: var(--primary-color);
}

.toast.error {
    border-left-color: var(--accent-color);
}

.toast.warning {
    border-left-color: #ffa726;
}

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

.toast.success .toast-icon {
    color: var(--primary-color);
}

.toast.error .toast-icon {
    color: var(--accent-color);
}

.toast.warning .toast-icon {
    color: #ffa726;
}

.toast-message {
    flex: 1;
    font-weight: 500;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.25rem;
}

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

/* Footer */
footer {
    background: var(--text-dark);
    color: var(--white);
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 3rem;
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        padding: 0 1rem;
    }
    
    .header-content h1 {
        font-size: 1.25rem;
    }
    
    .health-score {
        font-size: 0.875rem;
    }
    
    .dashboard-cards {
        grid-template-columns: 1fr;
    }
    
    .quick-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .toast-container {
        left: 1rem;
        right: 1rem;
    }
    
    .toast {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 0.5rem;
    }
    
    .card-header,
    .card-content {
        padding: 0.75rem;
    }
    
    .bill-item {
        padding: 0.75rem;
    }
    
    .bill-details {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .nav-btn {
        padding: 0.5rem;
        font-size: 0.7rem;
    }
    
    .nav-btn i {
        font-size: 1rem;
    }
}

/* Scroll Snap */
.bills-timeline {
    scroll-snap-type: y mandatory;
}

.bill-item {
    scroll-snap-align: start;
}

/* Performance Optimizations */
.bill-item,
.card,
.modal-content {
    will-change: transform;
}

/* Touch Gestures Support */
.bill-item {
    touch-action: pan-y;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
        --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.4);
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .water-flow {
        animation: none;
    }
}
