:root {
    /* Brand Colors */
    --primary: #8A05BE; /* Purple style Nubank */
    --primary-hover: #7300a3;
    --secondary: #FF7A00; /* Orange style Inter */
    
    /* Semantic Colors */
    --success: #20C05C;
    --danger: #FD4F48;
    --warning: #FFB020;
    
    /* Fonts & Structure */
    --font-main: 'Inter', sans-serif;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-round: 50%;
    --transition: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Dark Theme (Default in our HTML) */
body.theme-dark {
    --bg-color: #121214;
    --surface-1: #202024;
    --surface-2: #29292E;
    --border-color: #323238;
    --text-title: #E1E1E6;
    --text-body: #C4C4CC;
    --text-muted: #8D8D99;
}

/* Light Theme */
body.theme-light {
    --bg-color: #F8F9FA;
    --surface-1: #FFFFFF;
    --surface-2: #F1F3F5;
    --border-color: #E9ECEF;
    --text-title: #212529;
    --text-body: #495057;
    --text-muted: #868E96;
}

/* CSS Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-body);
    transition: background-color var(--transition), color var(--transition);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-title);
    font-weight: 600;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

/* Views Management */
.view {
    display: none;
    opacity: 0;
    transition: opacity var(--transition);
}

.view.active {
    display: flex; /* For login flexbox, overridden for app */
    opacity: 1;
}

#app-screen.active {
    display: flex;
    height: 100vh;
}

/* Login Screen */
#login-screen {
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-container {
    background: var(--surface-1);
    padding: 40px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
    color: var(--primary);
}

.logo i {
    font-size: 2.5rem;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 32px;
}

/* Forms */
.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.875rem;
    color: var(--text-title);
    font-weight: 500;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    font-size: 1.25rem;
}

input, select {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    color: var(--text-title);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-size: 1rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.input-wrapper input {
    padding-left: 48px;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(138, 5, 190, 0.2);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-main);
}

.btn-primary {
    background: var(--primary);
    color: #FFF;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(138, 5, 190, 0.3);
}

.btn-outline {
    background: transparent;
    color: var(--text-title);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    background: var(--surface-2);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color var(--transition);
    border-radius: var(--radius-round);
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.btn-icon:hover {
    color: var(--text-title);
    background: var(--surface-2);
}

.badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--danger);
    color: #fff;
    font-size: 0.625rem;
    font-weight: bold;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-footer {
    margin-top: 24px;
    font-size: 0.875rem;
}

.login-footer a {
    display: block;
    margin-bottom: 8px;
}

/* Layout App */
.sidebar {
    width: 260px;
    background: var(--surface-1);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    transition: transform var(--transition);
}

.logo-sidebar {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--primary);
    margin-bottom: 40px;
}

.logo-sidebar i {
    font-size: 2rem;
}

.nav-links {
    list-style: none;
    flex: 1;
}

.nav-links li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

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

.nav-links li:hover {
    background: var(--surface-2);
    color: var(--text-title);
}

.nav-links li.active {
    background: var(--primary);
    color: #fff;
}

.user-sidebar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.user-sidebar img {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-round);
}

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

#user-name {
    font-weight: 500;
    color: var(--text-title);
    font-size: 0.875rem;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.topbar {
    height: 80px;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-1);
    border-bottom: 1px solid var(--border-color);
    z-index: 10;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--surface-1);
    width: 100%;
    max-width: 480px;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    transform: translateY(20px);
    transition: transform var(--transition);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

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

.modal-body {
    padding: 24px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 32px;
}

/* Cards UI - Injected via JS Component */
/* Card Styling */
.credit-card {
    width: 320px;
    height: 200px;
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
    transition: transform var(--transition);
    cursor: pointer;
    flex-shrink: 0;
}

.credit-card:hover {
    transform: translateY(-5px);
}

.card-bg {
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 2;
}

.card-brand {
    font-size: 1.5rem;
    font-weight: bold;
}

.card-chip {
    width: 40px;
    height: 30px;
    background: linear-gradient(135deg, #e0c38c, #c9a45e);
    border-radius: 4px;
}

.card-middle {
    position: relative;
    z-index: 2;
}

.card-number {
    font-family: monospace;
    font-size: 1.25rem;
    letter-spacing: 2px;
    margin-top: 10px;
}

.card-bottom {
    display: flex;
    justify-content: space-between;
    position: relative;
    z-index: 2;
}

.card-holder, .card-expires {
    font-size: 0.875rem;
    opacity: 0.9;
    text-transform: uppercase;
}

/* Dashboard Layout */
.grid-dashboard {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 32px;
}

.dashboard-section {
    margin-bottom: 32px;
}

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

.cards-container {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 16px;
    scrollbar-width: none;
}
.cards-container::-webkit-scrollbar {
    display: none;
}

/* Summary Cards */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.summary-card {
    background: var(--surface-1);
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.summary-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-round);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.icon-purple { background: rgba(138, 5, 190, 0.1); color: var(--primary); }
.icon-orange { background: rgba(255, 122, 0, 0.1); color: var(--secondary); }
.icon-green { background: rgba(32, 192, 92, 0.1); color: var(--success); }
.icon-red { background: rgba(253, 79, 72, 0.1); color: var(--danger); }

.summary-info h4 {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
}

.summary-info h2 {
    font-size: 1.5rem;
    color: var(--text-title);
}

/* Transaction List */
.transaction-list {
    background: var(--surface-1);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.transaction-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition);
}

.transaction-item:hover {
    background: var(--surface-2);
}

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

.transaction-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.transaction-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--text-title);
}

.transaction-details h4 {
    color: var(--text-title);
    margin-bottom: 4px;
}

.transaction-details p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.transaction-right {
    text-align: right;
}

.transaction-amount {
    font-weight: 600;
    color: var(--text-title);
    margin-bottom: 4px;
}

.transaction-card-tag {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--surface-2);
}

/* Card details screen */
.card-detail-header {
    display: flex;
    gap: 40px;
    background: var(--surface-1);
    padding: 32px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    margin-bottom: 32px;
}

.limit-bar-bg {
    width: 100%;
    height: 8px;
    background: var(--surface-2);
    border-radius: 4px;
    margin-top: 16px;
    overflow: hidden;
}

.limit-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
}

.limit-info {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    #app-screen.active {
        flex-direction: column;
    }

    /* Transform Sidebar into Bottom Nav */
    .sidebar {
        width: 100%;
        height: 70px;
        flex-direction: row;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 0;
        border-right: none;
        border-top: 1px solid var(--border-color);
        z-index: 1000;
        justify-content: space-around;
        align-items: center;
        background: var(--surface-1);
    }

    .logo-sidebar, .user-sidebar {
        display: none; /* Hide logo and user on bottom nav */
    }

    .nav-links {
        display: flex;
        width: 100%;
        justify-content: space-around;
        padding: 0 8px;
    }

    .nav-links li {
        flex-direction: column;
        gap: 4px;
        padding: 8px 12px;
        margin-bottom: 0;
        font-size: 0.65rem;
        background: transparent !important;
        color: var(--text-muted);
    }

    .nav-links li i {
        font-size: 1.5rem;
    }

    .nav-links li.active {
        color: var(--primary);
    }

    /* Adjust Main Content */
    .main-content {
        height: calc(100vh - 70px);
        margin-bottom: 70px;
    }

    .topbar {
        height: 60px;
        padding: 0 16px;
    }

    .topbar h2 {
        font-size: 1.1rem;
    }

    .topbar-right {
        gap: 8px;
    }

    #btn-add-transaction span {
        display: none; /* Icon only on mobile button to save space */
    }

    #btn-add-transaction {
        padding: 8px;
        border-radius: var(--radius-round);
    }

    .scroll-area {
        padding: 16px;
    }

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

    .card-detail-header {
        flex-direction: column;
        padding: 20px;
        gap: 20px;
    }

    /* Fix Modals on Mobile */
    .modal {
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        position: absolute;
        bottom: 0;
        transform: translateY(100%);
    }

    .modal-overlay.active .modal {
        transform: translateY(0);
    }
}

/* Toast Notifications (Simulador de Webhook) */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1000;
}

.toast {
    background: var(--surface-1);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.4s;
    width: 300px;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-icon {
    font-size: 1.5rem;
    color: var(--primary);
    margin-top: 2px;
}

.toast-content h4 {
    color: var(--text-title);
    font-size: 0.875rem;
    margin-bottom: 4px;
}

.toast-content p {
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.4;
}
