:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #e0e0e0;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --border-color: #d0d0d0;
    --accent: #0066cc;
    --accent-hover: #0052a3;
    --error: #dc3545;
    --success: #28a745;
    --shadow: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #404040;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --border-color: #505050;
    --accent: #4a9eff;
    --accent-hover: #6bb3ff;
    --error: #ff6b6b;
    --success: #51cf66;
    --shadow: rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

.hidden {
    display: none !important;
}

.screen {
    min-height: 100vh;
}

/* Login Screen */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    box-shadow: 0 4px 6px var(--shadow);
}

.login-container h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.user-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.user-button {
    padding: 1rem;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-primary);
    transition: all 0.2s;
}

.user-button:hover {
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.login-form label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.login-form input {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.login-form input:focus {
    outline: none;
    border-color: var(--accent);
}

.login-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.login-actions button {
    padding: 0.75rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

#loginButton {
    background: var(--accent);
    color: white;
}

#loginButton:hover {
    background: var(--accent-hover);
}

#forgotPasswordButton {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

#forgotPasswordButton:hover {
    background: var(--border-color);
}

.error {
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--error);
    color: white;
    border-radius: 4px;
    text-align: center;
}

.success {
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--success);
    color: white;
    border-radius: 4px;
    text-align: center;
}

/* Main App */
header {
    background: var(--bg-secondary);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 1rem;
}

header h1 {
    font-size: 1.5rem;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
}

#userDisplay {
    color: var(--text-secondary);
}

#logoutButton {
    padding: 0.5rem 1rem;
    background: var(--error);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

#logoutButton:hover {
    opacity: 0.9;
}

main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

.investors-container h2 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.investor-form-container {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px var(--shadow);
}

.investor-form-container h2 {
    margin-bottom: 1rem;
}

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

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

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

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

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

#investorForm button[type="submit"],
#cancelEditButton {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 1rem;
    transition: background-color 0.2s;
}

#investorForm button[type="submit"] {
    background: var(--accent);
    color: white;
}

#investorForm button[type="submit"]:hover {
    background: var(--accent-hover);
}

#cancelEditButton {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    margin-left: 0.5rem;
}

.filter-sort-bar {
    background: var(--bg-secondary);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px var(--shadow);
}

.filter-row {
    display: flex;
    gap: 1rem;
    align-items: end;
    flex-wrap: nowrap;
    width: 100%;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1 1 0;
    min-width: 140px;
}

.filter-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.filter-group select {
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--accent);
}

.investors-list {
    display: grid;
    gap: 0.5rem;
}

.investor-card {
    background: var(--bg-secondary);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    box-shadow: 0 1px 3px var(--shadow);
    border-left: 4px solid var(--accent);
}

.investor-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.investor-title {
    flex: 1;
}

.investor-title h3 {
    font-size: 1.1rem;
    margin-bottom: 0.15rem;
}

.investor-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

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

.btn {
    padding: 0.4rem 0.6rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    min-height: 2rem;
}

.btn-edit {
    background: transparent;
    color: var(--accent);
    font-size: 1.1rem;
}

.btn-edit:hover {
    background: var(--bg-tertiary);
}

.btn-delete {
    background: transparent;
    color: var(--error);
    font-size: 1.1rem;
}

.btn-delete:hover {
    background: var(--bg-tertiary);
}

.investor-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-primary);
    border-radius: 4px;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.15rem;
}

.detail-value {
    font-weight: 500;
}

.tasks-section {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.tasks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.tasks-header h4 {
    font-size: 0.9rem;
    margin: 0;
}

.btn-add-task {
    background: transparent;
    border: none;
    color: var(--accent);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-add-task:hover {
    background: var(--bg-tertiary);
}

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    background: var(--bg-primary);
    border-radius: 3px;
    border: 1px solid var(--border-color);
}

.task-item input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

.task-item.done {
    opacity: 0.6;
}

.task-item.done .task-description {
    text-decoration: line-through;
}

.task-description {
    flex: 1;
}

.task-due {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.task-actions {
    display: flex;
    gap: 0.25rem;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-small:hover {
    background: var(--border-color);
}

/* Add task form removed - now in modal */

/* Mobile Responsive */
@media (max-width: 768px) {
    header {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
    }

    main {
        padding: 1rem;
    }

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

    .investor-header {
        flex-direction: column;
    }

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

    .login-container {
        margin: 50px 1rem;
        padding: 1.5rem;
    }

    .filter-row {
        flex-wrap: wrap;
    }

    .filter-group {
        flex: 1 1 calc(50% - 0.5rem);
        min-width: 150px;
    }
}

@media (max-width: 480px) {
    .investor-actions {
        flex-direction: column;
        width: 100%;
    }

    .btn {
        width: 100%;
    }

}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.modal-content {
    position: relative;
    background: var(--bg-primary);
    border-radius: 8px;
    box-shadow: 0 8px 32px var(--shadow);
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1001;
    animation: modalSlideIn 0.3s ease-out;
}

.modal-small {
    max-width: 400px;
}

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

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

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

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

.modal-actions button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.modal-actions button[type="submit"] {
    background: var(--accent);
    color: white;
}

.modal-actions button[type="submit"]:hover {
    background: var(--accent-hover);
}

.modal-actions #cancelModalButton,
.modal-actions #cancelEditButton {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-actions #cancelModalButton:hover,
.modal-actions #cancelEditButton:hover {
    background: var(--border-color);
}

.btn-header {
    padding: 0.5rem 1rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.btn-header:hover {
    background: var(--accent-hover);
}

/* Remove the old investor-form-container styles since it's now in modal */
.investor-form-container {
    display: none;
}

/* User Management Styles */
.users-section {
    margin-top: 1rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.section-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.users-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.user-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1rem;
}

.user-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-card-header > div:first-child {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.user-id {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-family: monospace;
}

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