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

:root {
    --purple-start: #6C5CE7;
    --purple-end: #A29BFE;
    --orange-start: #FF7675;
    --orange-end: #FD79A8;
    --blue-start: #0984E3;
    --blue-end: #6C5CE7;
    --pink-start: #FD79A8;
    --pink-end: #FDCB6E;
    --green-start: #00B894;
    --green-end: #55EFC4;
    
    /* Dynamic theme colors (can be changed via JS) */
    --primary-color: #6C5CE7;
    --secondary-color: #A29BFE;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #F5F6FA;
    color: #2D3436;
    overflow-x: hidden;
}

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

.screen.active {
    display: block;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    /* Extend padding to cover status bar on iOS */
    padding-top: calc(20px + env(safe-area-inset-top));
    background: linear-gradient(135deg, var(--purple-start), var(--purple-end));
    color: white;
}

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

.logo svg {
    width: 28px;
    height: 28px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: white;
    letter-spacing: 0.5px;
}

.header h2 {
    font-size: 20px;
    font-weight: 600;
}

.menu-btn, .stats-btn, .back-btn, .add-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.stats-btn, .add-btn {
    background: none;
    border-radius: 0;
    position: relative;
}

.stats-btn::after, .add-btn::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    background: #FF3B30;
    border-radius: 50%;
}

.menu-btn:active, .stats-btn:active, .back-btn:active, .add-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.3);
}

.stats-btn:active, .add-btn:active {
    background: none;
}

/* Balance Card */
.balance-card {
    margin: 20px;
    padding: 30px;
    border-radius: 24px;
    color: white;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(108, 92, 231, 0.3);
}

.gradient-purple {
    background: linear-gradient(135deg, var(--purple-start), var(--purple-end));
}

.gradient-orange {
    background: linear-gradient(135deg, var(--orange-start), var(--orange-end));
}

.gradient-blue {
    background: linear-gradient(135deg, var(--blue-start), var(--blue-end));
}

.gradient-pink {
    background: linear-gradient(135deg, var(--pink-start), var(--pink-end));
}

.gradient-green {
    background: linear-gradient(135deg, var(--green-start), var(--green-end));
}

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

.balance-label {
    font-size: 14px;
    opacity: 0.9;
    font-weight: 500;
    letter-spacing: 1px;
}

.balance-privacy-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 6px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: white;
}

.balance-privacy-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.balance-privacy-toggle:active {
    transform: scale(0.95);
}

.balance-privacy-toggle svg {
    width: 20px;
    height: 20px;
}

.balance-amount {
    font-size: 42px;
    font-weight: 700;
    margin: 10px 0;
    text-align: right;
    transition: all 0.3s ease;
}

.balance-sublabel {
    font-size: 14px;
    opacity: 0.8;
}

.balance-chart {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    opacity: 0.5;
}

.balance-chart svg {
    width: 100%;
    height: 100%;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    justify-content: space-around;
    padding: 20px;
    gap: 10px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    flex: 1;
}

.action-icon {
    width: 56px;
    height: 56px;
    background: white;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.action-btn:active .action-icon {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.action-label {
    font-size: 13px;
    font-weight: 500;
    color: #2D3436;
}

/* Section Header */
.section-header {
    padding: 20px 20px 12px 20px;
}

.section-header h3 {
    font-size: 17px;
    font-weight: 600;
    color: #2D3436;
}

/* Transactions */
.transactions {
    padding: 0 20px;
}

.transaction-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    background: white;
    border-radius: 16px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    cursor: pointer;
    transition: all 0.3s ease;
}

.transaction-item:active {
    transform: scale(0.98);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.transaction-icon {
    width: 48px;
    height: 48px;
    background: #F5F6FA;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.transaction-info {
    flex: 1;
}

.transaction-name {
    font-size: 13px;
    text-transform: uppercase;
    font-weight: 600;
    color: #2D3436;
    margin-bottom: 4px;
}

.transaction-date {
    font-size: 13px;
    color: #636E72;
}

.transaction-amount {
    font-size: 16px;
    font-weight: 700;
    color: #00B894;
}

.transaction-amount.negative {
    color: #D63031;
}

/* Cards Slider */
.cards-slider-wrapper {
    padding: 20px 0;
}

.cards-slider {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 20px;
    gap: 20px;
}

.cards-slider::-webkit-scrollbar {
    display: none;
}

.card-slide {
    flex: 0 0 85%;
    scroll-snap-align: center;
    transition: all 0.3s ease;
}

.card-item {
    padding: 24px;
    border-radius: 20px;
    color: white;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    /*box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);*/
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    width: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Card Header */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: auto;
}

/* Card NFC Icon */
.card-nfc-icon {
    position: absolute;
    left: 20px;
    bottom: 50%;
    width: 30px;
    height: 30px;
    opacity: 0.7;
}

.card-nfc-icon svg {
    width: 100%;
    height: 100%;
}

.card-cvv {
    font-size: 14px;
    font-weight: 500;
    opacity: 0.9;
}

.card-type-label {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    opacity: 0.85;
}

.card-logo {
    width: 80px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.card-logo svg {
    width: 100%;
    height: auto;
}

/* Card Content */
.card-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: flex-end;
}

.card-bottom {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    padding-bottom: 18px;
}

.card-number {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 1px;
    line-height: 1.2;
    white-space: nowrap;
}

.card-name {
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.3px;
    opacity: 0.95;
}

.card-expiry {
    font-size: 13px;
    font-weight: 500;
    opacity: 0.85;
    position: absolute;
    bottom: 0;
    right: 0;
}

/* Slider Dots */
.slider-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #DFE6E9;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dot.active {
    background: var(--primary-color);
    width: 24px;
    border-radius: 4px;
}

/* Card Controls */
.card-controls {
    margin: 10px 20px;
}

.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    margin-bottom: 10px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.toggle-label {
    font-size: 16px;
    font-weight: 500;
    color: #2D3436;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 51px;
    height: 31px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #DFE6E9;
    border-radius: 31px;
    transition: all 0.3s ease;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 27px;
    width: 27px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #16A085;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-switch:active .toggle-slider:before {
    width: 30px;
}

/* Card Info Section */
.card-info-section {
    margin: 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.info-header {
    padding: 16px 20px;
    border-bottom: 1px solid #F5F6FA;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #2D3436;
}

.privacy-toggle-btn {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s ease;
    color: #636E72;
}

.privacy-toggle-btn:hover {
    background: #F5F6FA;
    color: #2D3436;
}

.privacy-toggle-btn:active {
    transform: scale(0.95);
}

.privacy-toggle-btn svg {
    width: 24px;
    height: 24px;
}

.info-content {
    padding: 8px 0;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
}

.info-label {
    font-size: 14px;
    color: #636E72;
}

.info-value {
    font-size: 15px;
    font-weight: 600;
    color: #2D3436;
}

.info-value.negative {
    color: #D63031;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 12px 0 20px 0;
    /* Add safe area for devices with home indicator */
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.08);
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: #B2BEC3;
    cursor: pointer;
    padding: 8px 16px;
    transition: all 0.3s ease;
}

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

.nav-btn span {
    font-size: 12px;
    font-weight: 500;
}

.nav-btn:active {
    transform: scale(0.95);
}

/* Settings Screen Styles */
.settings-container {
    padding: 20px 20px 100px 20px;
    overflow-y: auto;
}

.settings-container .section-header:first-child {
    padding-top: 10px;
}

.settings-section {
    background: white;
    border-radius: 16px;
    padding: 0 20px 20px;
    margin-bottom: 20px;
}

.setting-item {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.setting-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: rgba(108, 92, 231, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.setting-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-label {
    font-size: 14px;
    font-weight: 600;
    color: #2D3436;
    display: block;
}

.setting-input {
    width: 100%;
    padding: 12px 16px;
    background: #F5F6FA;
    border: 2px solid transparent;
    border-radius: 12px;
    font-size: 16px;
    color: #2D3436;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    transition: all 0.2s ease;
}

.setting-input:focus {
    outline: none;
    border-color: #6C5CE7;
    background: white;
}

.setting-input::placeholder {
    color: #B2BEC3;
}

.setting-description {
    font-size: 12px;
    color: #B2BEC3;
    line-height: 1.4;
}

.save-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #6C5CE7 0%, #5B4CDB 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 20px 0 0 0;
}

.save-btn:active {
    transform: scale(0.98);
}

.save-btn svg {
    width: 18px;
    height: 18px;
}

.info-section {
    padding: 16px 20px !important;
}

.info-text {
    font-size: 12px;
    line-height: 1.6;
    color: #636E72;
    text-align: left;
}

.info-row {
    padding: 10px 0;
    line-height: 1.5;
    font-size: 13px;
    color: #636E72;
}

.info-row:not(:last-child) {
    border-bottom: 1px solid #F5F6FA;
}

.info-row-label {
    font-size: 14px;
    color: #636E72;
}

.info-row-value {
    font-size: 14px;
    font-weight: 600;
    color: #2D3436;
}

/* Compact Settings */
.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid #F5F6FA;
}

.setting-row:last-of-type {
    border-bottom: none;
    padding-bottom: 20px;
}

.setting-row .setting-label {
    font-size: 15px;
    font-weight: 500;
    color: #2D3436;
}

.setting-input-compact {
    width: 200px;
    padding: 8px 12px;
    background: #F5F6FA;
    border: 2px solid transparent;
    border-radius: 10px;
    font-size: 14px;
    color: #2D3436;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    transition: all 0.2s ease;
}

.setting-input-compact:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
}

.setting-input-compact::placeholder {
    color: #B2BEC3;
}

/* Theme Selector Compact */
.theme-selector-compact {
    display: flex;
    gap: 12px;
    align-items: center;
}

.theme-option-compact {
    cursor: pointer;
    display: inline-block;
}

.theme-option-compact input[type="radio"] {
    display: none;
}

.theme-option-compact input[type="radio"]:checked + .theme-color-compact {
    border: 3px solid white;
    box-shadow: 0 0 0 3px currentColor;
    transform: scale(1.1);
}

.theme-color-compact {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: block;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.theme-color-compact.purple {
    background: linear-gradient(135deg, #6C5CE7, #A29BFE);
    color: #6C5CE7;
}

.theme-color-compact.blue {
    background: linear-gradient(135deg, #0984E3, #74B9FF);
    color: #0984E3;
}

.theme-color-compact.green {
    background: linear-gradient(135deg, #00B894, #55EFC4);
    color: #00B894;
}

.action-secondary-btn {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 2px solid #DFE6E9;
    border-radius: 12px;
    color: #636E72;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 12px;
}

.action-secondary-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.action-secondary-btn:active {
    transform: scale(0.98);
}

.action-secondary-btn svg {
    width: 18px;
    height: 18px;
}

/* Responsive Design */
@media (min-width: 768px) {
    body {
        display: flex;
        justify-content: center;
        align-items: flex-start;
        padding: 20px;
        background: #DFE6E9;
    }

    .screen {
        max-width: 420px;
        width: 100%;
        background: #F5F6FA;
        border-radius: 24px;
        overflow: hidden;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    }

}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Touch feedback improvements */
@media (hover: none) {
    .action-btn:hover .action-icon,
    .transaction-item:hover,
    .card-item:hover,
    .action-button:hover {
        transform: none;
    }
}

