:root {
    --bg-gradient-start: #667eea;
    --bg-gradient-end: #764ba2;
    --text-primary: #333;
    --text-secondary: #666;
    --text-light: #999;
    --bg-white: #ffffff;
    --bg-light: #f5f5f5;
    --bg-lighter: #f9f9f9;
    --border-color: #e0e0e0;
    --card-shadow: rgba(0, 0, 0, 0.1);
    --card-shadow-hover: rgba(0, 0, 0, 0.2);
    --modal-bg: rgba(0, 0, 0, 0.5);
    --success-color: #4caf50;
    --error-color: #ff4444;
    --info-bg: #e8f0fe;
    --warning-bg: #fff3e0;
    --warning-color: #ff9800;
}

body.dark-mode {
    --bg-gradient-start: #1a1a2e;
    --bg-gradient-end: #16213e;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-light: #808080;
    --bg-white: #2a2a3e;
    --bg-light: #1f1f2e;
    --bg-lighter: #252535;
    --border-color: #3a3a4e;
    --card-shadow: rgba(0, 0, 0, 0.3);
    --card-shadow-hover: rgba(0, 0, 0, 0.5);
    --modal-bg: rgba(0, 0, 0, 0.7);
    --success-color: #4caf50;
    --error-color: #ff4444;
    --info-bg: #1e3a5f;
    --warning-bg: #3d2f1f;
    --warning-color: #ffb74d;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    padding: 20px;
    transition: background 0.3s ease;
}

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

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    position: relative;
}

h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.close-payment-alert {
    padding: 0 8px;
    font-size: 1.3em;
    font-weight: bold;
    line-height: 1;
}


.currency-selector {
    position: absolute;
    top: 0;
    left: 0;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s ease;
    font-weight: 500;
}

.currency-selector:hover {
    background: rgba(255, 255, 255, 0.3);
}

.currency-selector option {
    background: var(--bg-white);
    color: var(--text-primary);
}

.theme-toggle {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.portfolio-summary {
    background: var(--bg-white);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px var(--card-shadow);
    transition: all 0.3s ease;
}

.capital-display {
    text-align: left;
}

.capital-display h2 {
    color: var(--text-secondary);
    font-size: 1em;
    font-weight: normal;
    margin-bottom: 10px;
}

.capital-value {
    font-size: 3em;
    font-weight: bold;
    color: #667eea;
}

.account-overview {
    background: var(--bg-white);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px var(--card-shadow);
    transition: all 0.3s ease;
}

.account-overview h2 {
    color: var(--text-primary);
    margin-bottom: 20px;
}

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

.summary-card {
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

.summary-card h3 {
    font-size: 0.9em;
    opacity: 0.9;
    margin-bottom: 10px;
}

.summary-card .value {
    font-size: 1.8em;
    font-weight: bold;
}

.charts-section {
    background: var(--bg-white);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px var(--card-shadow);
}

.charts-section h2 {
    color: var(--text-primary);
    margin-bottom: 20px;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.chart-container {
    background: var(--bg-lighter);
    padding: 20px;
    border-radius: 10px;
    position: relative;
    height: 300px;
}

.add-platform-section {
    background: var(--bg-white);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px var(--card-shadow);
    transition: all 0.3s ease;
}

.add-platform-section h2 {
    color: var(--text-primary);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.data-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.export-btn {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    padding: 10px 20px;
    font-size: 0.9em;
}

.import-btn {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    padding: 10px 20px;
    font-size: 0.9em;
}

.reset-btn {
    background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
    padding: 10px 20px;
    font-size: 0.9em;
}

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

input,
select,
textarea {
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-white);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #667eea;
}

input[type="text"].full-width,
textarea {
    width: 100%;
}

input[type="file"] {
    display: none;
}

button {
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: transform 0.2s;
}

button:hover {
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

.platforms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.platform-box {
    background: var(--bg-white);
    border-radius: 15px;
    padding: 25px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 5px 15px var(--card-shadow);
    position: relative;
}

.platform-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px var(--card-shadow-hover);
}

.platform-box h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.platform-stats {
    color: var(--text-secondary);
    font-size: 0.9em;
    line-height: 1.6;
}

.platform-stats div {
    margin: 5px 0;
}

.delete-platform {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 1em;
    padding: 0;
}

.delete-platform:hover {
    background: #cc0000;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-bg);
    overflow-y: auto;
}

.modal-content {
    background-color: var(--bg-white);
    margin: 50px auto;
    padding: 30px;
    border-radius: 15px;
    max-width: 900px;
    box-shadow: 0 10px 50px var(--card-shadow-hover);
    transition: all 0.3s ease;
}

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

.modal-header h2 {
    color: var(--text-primary);
}

.close {
    font-size: 2em;
    cursor: pointer;
    color: var(--text-light);
}

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

.loan-form {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.loan-form h3 {
    color: var(--text-primary);
}

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 5px;
    font-weight: bold;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.form-group-full {
    grid-column: 1 / -1;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-group label {
    color: var(--text-primary) !important;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.repeat-options {
    display: none;
    background: var(--info-bg);
    padding: 15px;
    border-radius: 8px;
    margin-top: 10px;
}

.repeat-options.active {
    display: block;
}

.fixed-principal-options {
    display: none;
    background: var(--warning-bg);
    padding: 15px;
    border-radius: 8px;
    margin-top: 10px;
}

.fixed-principal-options.active {
    display: block;
}

.info-text {
    color: #667eea;
    font-size: 0.85em;
    font-style: italic;
    margin-top: 5px;
}

.calculated-info {
    background: var(--bg-white);
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
    font-size: 0.9em;
    color: var(--text-primary);
}

.loans-list {
    margin-top: 20px;
}

.loans-list h3 {
    color: var(--text-primary);
}

.loan-item {
    background: var(--bg-lighter);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid #667eea;
}

.loan-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 10px;
}

.loan-title {
    font-size: 1.1em;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.loan-details {
    color: var(--text-secondary);
    line-height: 1.6;
}

.loan-details-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.detail-item {
    background: var(--bg-white);
    padding: 8px;
    border-radius: 5px;
    font-size: 0.9em;
    color: var(--text-primary);
}

.detail-label {
    font-weight: bold;
    color: #667eea;
}

.loan-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.edit-loan {
    background: #2196F3;
    padding: 8px 15px;
    font-size: 0.9em;
}

.delete-loan {
    background: #ff4444;
    padding: 8px 15px;
    font-size: 0.9em;
}

.cancel-edit {
    background: #999;
    padding: 8px 20px;
    font-size: 0.9em;
    margin-left: 10px;
}

.platform-overview {
    background: var(--info-bg);
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

.platform-overview h3 {
    color: var(--text-primary);
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.overview-item {
    background: var(--bg-white);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.overview-item h4 {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.overview-item .value {
    font-size: 1.4em;
    color: #667eea;
    font-weight: bold;
}

.no-platforms {
    text-align: center;
    padding: 40px;
    color: white;
    font-size: 1.2em;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
    margin-left: 5px;
}

.badge-bullet {
    background: #ff9800;
    color: white;
}

.badge-repeat {
    background: #4caf50;
    color: white;
}

.badge-fixed-principal {
    background: #9c27b0;
    color: white;
}

.badge-personal {
    background: #2196F3;
    color: white;
}

.badge-business {
    background: #FF9800;
    color: white;
}

.badge-auto {
    background: #9C27B0;
    color: white;
}

.badge-real_estate {
    background: #4CAF50;
    color: white;
}

.badge-other {
    background: #607D8B;
    color: white;
}

.edit-mode-badge {
    background: #2196F3;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.9em;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-white);
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 5px 20px var(--card-shadow-hover);
    z-index: 2000;
    display: none;
    animation: slideIn 0.3s ease-out;
    color: var(--text-primary);
}

.notification.success {
    border-left: 4px solid #4caf50;
}

.notification.error {
    border-left: 4px solid #ff4444;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Install Prompt Styles */
.install-prompt {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-white);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 40px var(--card-shadow-hover);
    z-index: 3000;
    max-width: 90%;
    width: 400px;
    border: 2px solid #667eea;
    animation: slideUp 0.5s ease-out;
}

.install-prompt.show {
    display: block;
}

.install-prompt-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.install-prompt-icon {
    font-size: 2.5em;
}

.install-prompt-text h3 {
    color: #667eea;
    margin-bottom: 5px;
    font-size: 1.2em;
}

.install-prompt-text p {
    color: var(--text-secondary);
    font-size: 0.9em;
    line-height: 1.4;
}

.install-prompt-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.install-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9em;
}

.dismiss-btn {
    background: var(--border-color);
    color: var(--text-secondary);
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }

    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Mobile responsive adjustments */
@media (max-width: 480px) {
    .install-prompt {
        width: calc(100% - 40px);
        padding: 15px;
    }

    .install-prompt-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .install-prompt-buttons {
        flex-direction: column;
    }

    .install-btn,
    .dismiss-btn {
        width: 100%;
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    h1 {
        font-size: 1.8em;
    }

    .theme-toggle {
        position: static;
        margin: 10px auto 20px;
        width: fit-content;
    }

    .currency-selector {
        position: static;
        margin: 10px auto;
        width: fit-content;
    }

    .portfolio-summary,
    .account-overview,
    .add-platform-section {
        padding: 15px;
    }

    .capital-value {
        font-size: 2.2em;
    }

    .summary-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 10px;
    }

    .summary-card {
        padding: 15px;
    }

    .summary-card h3 {
        font-size: 0.8em;
    }

    .summary-card .value {
        font-size: 1.4em;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .data-buttons {
        width: 100%;
        justify-content: flex-start;
    }

    .export-btn,
    .import-btn,
    .reset-btn {
        padding: 8px 15px;
        font-size: 0.85em;
        flex: 1;
        min-width: 80px;
    }

    .platforms-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .platform-box {
        padding: 20px;
    }

    .modal-content {
        margin: 20px auto;
        padding: 20px;
        max-width: 95%;
    }

    .loan-form {
        padding: 15px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .loan-details-row {
        grid-template-columns: 1fr;
    }

    .loan-actions {
        flex-direction: column;
        width: 100%;
    }

    .loan-actions button {
        width: 100%;
    }

    .overview-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 10px;
    }

    .overview-item {
        padding: 10px;
    }

    .overview-item .value {
        font-size: 1.2em;
    }

    .input-group {
        flex-direction: column;
    }

    .input-group input {
        width: 100%;
    }

    .input-group button {
        width: 100%;
    }

    .notification {
        left: 10px;
        right: 10px;
        max-width: calc(100% - 20px);
    }

    .install-prompt {
        bottom: 10px;
        width: calc(100% - 20px);
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .chart-container {
        height: 250px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5em;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .summary-card .value {
        font-size: 1.3em;
    }

    .data-buttons {
        flex-direction: column;
    }

    .export-btn,
    .import-btn,
    .reset-btn {
        width: 100%;
    }

    .platform-box h3 {
        font-size: 1.1em;
    }

    .overview-grid {
        grid-template-columns: 1fr;
    }
}
