/* ================= RESET & GLOBAL STYLES ================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="2" fill="rgba(255,255,255,0.1)"/></svg>');
    animation: float 20s linear infinite;
    pointer-events: none;
}

@keyframes float {
    0% { transform: translateY(0); }
    100% { transform: translateY(-100px); }
}

/* ================= AUTH CONTAINER (Login/Signup) ================= */
.auth-container {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 420px;
    animation: slideDown 0.6s ease-out;
}

/* ================= DASHBOARD CONTAINER ================= */
.dashboard-container {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 1000px;
    animation: slideDown 0.6s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================= HEADINGS ================= */
h1 {
    text-align: center;
    color: #333;
    font-size: 2.5em;
    margin-bottom: 30px;
    font-weight: 700;
}

h2 {
    color: #333;
    font-size: 28px;
    margin-bottom: 10px;
    text-align: center;
    font-weight: 600;
}

.subtitle {
    color: #666;
    text-align: center;
    margin-bottom: 30px;
    font-size: 14px;
}

/* ================= DASHBOARD HEADER ================= */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.user-info {
    flex: 1;
}

.user-info #user {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.dashboard-title {
    flex: 1;
    text-align: center;
}

.dashboard-title h1 {
    margin: 0;
    font-size: 2em;
    color: #333;
}

.logout-container {
    flex: 1;
    text-align: right;
}

/* ================= FORM STYLES ================= */
form {
    margin-top: 20px;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    color: #555;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    font-family: inherit;
    background: white;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

input::placeholder {
    color: #999;
}

/* ================= BUTTONS ================= */
button {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

button[type="submit"] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-top: 10px;
}

button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

button[type="submit"]:active {
    transform: translateY(0);
}

.secondary-btn {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    margin-top: 12px;
}

.secondary-btn:hover {
    background: #f8f9ff;
}

.logout-btn {
    background: #ff4757;
    color: white;
    width: auto;
    padding: 10px 24px;
    margin: 0;
    font-size: 14px;
}

.logout-btn:hover {
    background: #ee2f3f;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 71, 87, 0.4);
}

/* ================= EXPENSE TRACKER SECTIONS ================= */
.container {
    width: 100%;
}

.balance-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.balance-section h3 {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9em;
    font-weight: 400;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
}

#total {
    font-size: 3em;
    font-weight: bold;
    color: white;
    margin-bottom: 20px;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 20px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    text-align: center;
}

.stat-card:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.2);
}

.stat-card p {
    color: white;
    font-size: 1.8em;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-card small {
    color: rgba(255,255,255,0.9);
    font-size: 0.85em;
}

.stat-card.income {
    border-left: 4px solid #4ade80;
}

.stat-card.expense {
    border-left: 4px solid #f87171;
}

/* ================= INPUT SECTION ================= */
.input-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.input-group {
    margin-bottom: 15px;
}

.input-section button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-top: 5px;
}

.input-section button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

/* ================= TABLE SECTION ================= */
.table-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

th {
    padding: 15px;
    text-align: left;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 1px;
}

td {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
}

tbody tr {
    transition: all 0.2s ease;
    animation: slideIn 0.3s ease-out;
}

tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.type-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
}

.type-badge.income {
    background: #dcfce7;
    color: #16a34a;
}

.type-badge.expense {
    background: #fee2e2;
    color: #dc2626;
}

.delete-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85em;
    font-weight: 600;
    width: auto;
}

.delete-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.amount-positive {
    color: #16a34a;
    font-weight: bold;
}

.amount-negative {
    color: #dc2626;
    font-weight: bold;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
    font-style: italic;
}

/* ================= LINKS ================= */
p {
    text-align: center;
    margin-top: 20px;
    color: #666;
    font-size: 14px;
}

a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

a:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* ================= RESPONSIVE DESIGN ================= */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }

    .auth-container,
    .dashboard-container {
        padding: 25px 20px;
    }
    
    h1 {
        font-size: 1.8em;
    }

    h2 {
        font-size: 24px;
    }

    #total {
        font-size: 2.2em;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-card p {
        font-size: 1.5em;
    }

    .input-section,
    .table-section {
        padding: 20px 15px;
    }

    th, td {
        padding: 10px 8px;
        font-size: 0.85em;
    }

    .delete-btn {
        padding: 6px 12px;
        font-size: 0.75em;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5em;
    }

    #total {
        font-size: 2em;
    }

    .balance-section,
    .input-section,
    .table-section {
        padding: 15px;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"] {
        padding: 10px 14px;
        font-size: 14px;
    }

    button {
        padding: 12px;
        font-size: 15px;
    }
}