/* --- CSS Variables & Theme --- */
:root {
    /* Colors: Dark Plum & Muted Rose Theme */
    --bg-dark: #0f0f13;
    --bg-card: #1a1a20;
    --bg-input: #25252e;
    
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --text-white: #ffffff;
    
    --primary: #722f37; /* Wine Red */
    --primary-hover: #900c3f; /* Deep Plum */
    --accent: #d48c9e; /* Muted Rose */
    --accent-glow: rgba(212, 140, 158, 0.3);
    
    --success: #4caf50;
    --error: #f44336;
    
    --font-heading: 'Poppins', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    --radius: 12px;
    --transition: all 0.3s ease;
}

/* --- Reset & Base --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    color: var(--text-white);
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

input {
    font-family: var(--font-body);
}

/* --- Utilities --- */
.hidden {
    display: none !important;
}

.full-width {
    width: 100%;
}

.accent {
    color: var(--accent);
}

/* --- Buttons --- */
.btn {
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    border: none;
    font-size: 0.95rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    box-shadow: 0 4px 15px rgba(114, 47, 55, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(114, 47, 55, 0.6);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
}

.btn-outline:hover {
    border-color: var(--text-white);
    color: var(--text-white);
}

.btn-action {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-white);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    font-size: 0.85rem;
}

.btn-action:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
}

/* --- Toast Notifications --- */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-card);
    color: var(--text-white);
    padding: 15px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--accent);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease forwards;
    min-width: 300px;
}

.toast.error {
    border-left-color: var(--error);
}

.toast.success {
    border-left-color: var(--success);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* --- Authentication Section --- */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, rgba(114, 47, 55, 0.15), transparent 40%);
    padding: 20px;
}

.auth-card {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 16px;
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.05);
    animation: fadeIn 0.5s ease;
}

.brand-header {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-white);
}

.brand-header i {
    font-size: 2rem;
    color: var(--accent);
    margin-bottom: 10px;
}

.brand-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

.auth-view {
    display: none;
    animation: fadeIn 0.4s ease;
}

.auth-view.active {
    display: block;
}

.auth-view h2 {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 25px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.input-group input {
    width: 100%;
    padding: 12px 15px;
    background: var(--bg-input);
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-white);
    outline: none;
    transition: var(--transition);
}

.input-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.auth-switch {
    margin-top: 25px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-switch a {
    color: var(--accent);
    font-weight: 600;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* --- Dashboard Section --- */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-card);
    padding: 30px 20px;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
}

.sidebar .brand-header {
    text-align: left;
    margin-bottom: 40px;
    padding-left: 10px;
}

.sidebar .brand-header h1 {
    font-size: 1.5rem;
    display: inline;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
}

.nav-item {
    padding: 12px 15px;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-white);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(114, 47, 55, 0.2), transparent);
    color: var(--accent);
    border-left: 3px solid var(--accent);
}

.sidebar-footer {
    margin-top: 20px;
}

/* Main Content */
.main-content {
    margin-left: 260px;
    flex-grow: 1;
    padding: 30px 40px;
    background: var(--bg-dark);
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: white;
}

/* Dashboard Views */
.dashboard-view {
    display: none;
    animation: slideUp 0.4s ease;
}

.dashboard-view.active {
    display: block;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Balance Card */
.balance-card {
    background: linear-gradient(135deg, var(--bg-card), #25252e);
    padding: 30px;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: var(--shadow);
}

.balance-info p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.balance-info h1 {
    font-size: 2.5rem;
    color: var(--text-white);
}

.card-actions {
    display: flex;
    gap: 15px;
}

/* Transactions */
.recent-transactions, .form-card, .table-container {
    background: var(--bg-card);
    padding: 25px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.recent-transactions h3, .form-card h3, .table-container h3 {
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.transaction-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    transition: var(--transition);
}

.transaction-item:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(5px);
}

.t-info {
    display: flex;
    flex-direction: column;
}

.t-type {
    font-weight: 600;
    color: var(--text-white);
}

.t-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.t-amount {
    font-weight: 700;
    font-family: var(--font-heading);
}

.t-amount.positive { color: var(--success); }
.t-amount.negative { color: var(--error); }

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
}

/* Table */
.transaction-table {
    width: 100%;
    border-collapse: collapse;
}

.transaction-table th {
    text-align: left;
    padding: 15px;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.transaction-table td {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

/* Profile */
.profile-detail p {
    margin-bottom: 15px;
    font-size: 1rem;
    color: var(--text-muted);
}

.profile-detail strong {
    color: var(--text-white);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideUp 0.3s ease;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: var(--transition);
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        padding: 20px;
    }
    .balance-card {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    .card-actions {
        width: 100%;
        justify-content: center;
    }
    .transaction-table {
        display: block;
        overflow-x: auto;
    }
}