/* ============================================
   Stiefeld Banking – Design System
   Premium dark-mode, mobile-first
   Accent: Comdirect Yellow #ffe100
   ============================================ */

/* -- Custom Properties -- */
:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #111128;
    --bg-card: rgba(20, 20, 50, 0.6);
    --bg-card-solid: #14143a;
    --bg-input: rgba(255, 255, 255, 0.06);
    --bg-hover: rgba(255, 225, 0, 0.08);

    --text-primary: #f0f0f5;
    --text-secondary: #9494b8;
    --text-muted: #5e5e80;

    --accent: #ffe100;
    --accent-dim: rgba(255, 225, 0, 0.15);
    --accent-glow: rgba(255, 225, 0, 0.3);

    --success: #00d68f;
    --danger: #ff4d6a;
    --warning: #ffaa00;
    --info: #4da6ff;

    --border: rgba(255, 255, 255, 0.06);
    --border-accent: rgba(255, 225, 0, 0.2);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --shadow-card: 0 4px 30px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px rgba(255, 225, 0, 0.08);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --header-height: 60px;
    --footer-height: 36px;
    --content-max-width: 480px;
}

/* -- Reset -- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100dvh;
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* -- Background Glow -- */
body::before {
    content: '';
    position: fixed;
    top: -40%;
    left: -20%;
    width: 80%;
    height: 80%;
    background: radial-gradient(ellipse, rgba(255, 225, 0, 0.03) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* -- App Shell -- */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    position: relative;
    z-index: 1;
}

/* -- Header -- */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(10, 10, 26, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    transition: transform 0.3s ease;
}

.app-header.hidden {
    transform: translateY(-100%);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 16px;
    height: 100%;
}

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

.header-logo {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.header-title {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-primary);
    text-transform: uppercase;
}

.header-title-accent {
    color: var(--accent);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* -- Buttons -- */
.btn-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--accent);
    border-color: var(--border-accent);
}

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

.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    background: var(--accent);
    color: #0a0a1a;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
}

.btn-primary:hover {
    background: #f5d800;
    box-shadow: 0 4px 20px rgba(255, 225, 0, 0.25);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 20px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-accent);
}

.btn-danger {
    background: rgba(255, 77, 106, 0.15);
    color: var(--danger);
    border: 1px solid rgba(255, 77, 106, 0.2);
}

.btn-danger:hover {
    background: rgba(255, 77, 106, 0.25);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    width: auto;
}

/* -- Content -- */
.app-content {
    flex: 1;
    padding: calc(var(--header-height) + 16px) 16px calc(var(--footer-height) + 16px);
    max-width: var(--content-max-width);
    margin: 0 auto;
    width: 100%;
}

/* -- Cards -- */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
    animation: fadeInUp 0.4s ease both;
}

.card-accent {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-card), var(--shadow-glow);
}

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

.card-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
}

.card-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 20px;
}

.badge-success {
    background: rgba(0, 214, 143, 0.15);
    color: var(--success);
}

.badge-danger {
    background: rgba(255, 77, 106, 0.15);
    color: var(--danger);
}

.badge-warning {
    background: rgba(255, 170, 0, 0.15);
    color: var(--warning);
}

/* -- Balance Display -- */
.balance-value {
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.1;
    margin-bottom: 4px;
}

.balance-value .currency {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-left: 4px;
}

.balance-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* -- Budget Display -- */
.budget-ring {
    display: flex;
    align-items: center;
    gap: 20px;
}

.budget-circle {
    position: relative;
    width: 90px;
    height: 90px;
    flex-shrink: 0;
}

.budget-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.budget-circle-bg {
    fill: none;
    stroke: var(--bg-input);
    stroke-width: 6;
}

.budget-circle-fill {
    fill: none;
    stroke: var(--accent);
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.8s ease;
}

.budget-circle-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.budget-days-number {
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1;
    color: var(--accent);
}

.budget-days-label {
    font-size: 0.55rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.budget-info {
    flex: 1;
}

.budget-amount {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.1;
}

.budget-amount .currency {
    font-size: 1rem;
    color: var(--text-secondary);
}

.budget-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.budget-target {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* -- Transaction List -- */
.transaction-list {
    list-style: none;
}

.transaction-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    animation: fadeInUp 0.3s ease both;
}

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

.transaction-item[data-index] {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s ease;
    border-radius: var(--radius-sm);
    margin: 0 -8px;
    padding: 12px 8px;
}

.transaction-item[data-index]:active {
    background: var(--bg-hover);
}

.transaction-left {
    flex: 1;
    min-width: 0;
}

.transaction-name {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.transaction-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.transaction-amount {
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
    margin-left: 12px;
}

.transaction-amount.credit {
    color: var(--success);
}

.transaction-amount.debit {
    color: var(--danger);
}

.transaction-status {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* -- Forms -- */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.95rem;
    transition: all 0.2s ease;
    outline: none;
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

.form-checkbox label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
}

/* -- Login Page -- */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100dvh - var(--footer-height));
    padding: 24px 16px;
}

.login-logo {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    object-fit: cover;
    animation: fadeInUp 0.5s ease;
}

.login-title {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 4px;
    animation: fadeInUp 0.5s ease 0.1s both;
}

.login-title span {
    color: var(--accent);
}

.login-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 32px;
    animation: fadeInUp 0.5s ease 0.2s both;
}

.login-card {
    width: 100%;
    max-width: 360px;
    animation: fadeInUp 0.5s ease 0.3s both;
}

/* -- Notification Banner -- */
.notification-banner {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(255, 170, 0, 0.1);
    border: 1px solid rgba(255, 170, 0, 0.2);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    animation: fadeInUp 0.4s ease;
}

.notification-banner.visible {
    display: flex;
}

.notification-banner .icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.notification-banner .message {
    font-size: 0.8rem;
    color: var(--warning);
    line-height: 1.4;
}

/* -- Admin Section -- */
.admin-section {
    margin-bottom: 24px;
}

.admin-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* -- Photo TAN Display -- */
.phototan-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    background: white;
    border-radius: var(--radius-md);
    margin: 16px 0;
}

.phototan-container img {
    max-width: 200px;
    width: 100%;
}

/* -- Modal / Dialog -- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 900;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: modalFadeIn 0.2s ease;
    padding: 16px;
}

.modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) var(--radius-lg);
    width: 100%;
    max-width: var(--content-max-width);
    max-height: 80dvh;
    overflow-y: auto;
    animation: modalSlideUp 0.3s ease;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.4);
}

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

.modal-header-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

.modal-body {
    padding: 20px;
}

.modal-amount {
    text-align: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.modal-amount-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
}

.modal-amount-value.credit { color: var(--success); }
.modal-amount-value.debit { color: var(--danger); }

.modal-amount-value .currency {
    font-size: 1.1rem;
    font-weight: 600;
    opacity: 0.7;
    margin-left: 4px;
}

.modal-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    gap: 16px;
}

.modal-detail-row:last-child {
    border-bottom: none;
}

.modal-detail-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    padding-top: 2px;
}

.modal-detail-value {
    font-size: 0.85rem;
    color: var(--text-primary);
    text-align: right;
    word-break: break-word;
    line-height: 1.4;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

/* -- Toast -- */
.toast-container {
    position: fixed;
    bottom: calc(var(--footer-height) + 16px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: 90%;
    max-width: 400px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 8px;
    animation: toastIn 0.3s ease;
    backdrop-filter: blur(10px);
}

.toast-success {
    background: rgba(0, 214, 143, 0.15);
    border: 1px solid rgba(0, 214, 143, 0.2);
    color: var(--success);
}

.toast-error {
    background: rgba(255, 77, 106, 0.15);
    border: 1px solid rgba(255, 77, 106, 0.2);
    color: var(--danger);
}

.toast-warning {
    background: rgba(255, 170, 0, 0.15);
    border: 1px solid rgba(255, 170, 0, 0.2);
    color: var(--warning);
}

/* -- Spinner -- */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 0;
    gap: 16px;
}

.loading-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* -- Skeleton -- */
.skeleton {
    background: linear-gradient(90deg, var(--bg-input) 25%, rgba(255, 255, 255, 0.06) 50%, var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: skeleton 1.5s ease infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 28px;
    width: 60%;
    margin-bottom: 8px;
}

.skeleton-circle {
    width: 90px;
    height: 90px;
    border-radius: 50%;
}

/* -- Footer -- */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--footer-height);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 26, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    z-index: 100;
}

.app-footer #build-info {
    font-size: 0.6rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

/* -- Page transitions -- */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* -- Empty State -- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px 16px;
    text-align: center;
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* -- Navigation Tabs (Admin) -- */
.nav-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: 16px;
}

.nav-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-tab.active {
    background: var(--accent);
    color: #0a0a1a;
}

/* -- Animations -- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes skeleton {
    to { background-position: -200% 0; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* -- Select element -- */
select.form-input {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239494b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    cursor: pointer;
}

select.form-input option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* -- Utilities -- */
.hidden { display: none !important; }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* -- Desktop (optional wider layout) -- */
@media (min-width: 600px) {
    :root {
        --content-max-width: 520px;
    }

    .balance-value {
        font-size: 2.8rem;
    }

    .budget-amount {
        font-size: 2rem;
    }
}
