/* ==========================================================================
   Base Styles & Design Tokens
   Inspired by Egyptian InstaPay aesthetic: Deep violet, crisp cards, mobile-first
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&display=swap');

:root {
    /* Brand Colors (InstaPay Inspired) */
    --color-primary: #4A154B;
    --color-primary-light: #6A216B;
    --color-primary-dark: #320B34;
    --color-primary-subtle: #F6EDF7;

    /* Financial Direction Indicators */
    --color-incoming: #10B981;
    --color-incoming-bg: #ECFDF5;
    --color-incoming-text: #047857;

    --color-outgoing: #EF4444;
    --color-outgoing-bg: #FEF2F2;
    --color-outgoing-text: #B91C1C;

    /* Neutral Surfaces & Grayscale */
    --color-bg: #F8FAFC;
    --color-surface: #FFFFFF;
    --color-surface-hover: #F1F5F9;
    --color-border: #E2E8F0;
    --color-border-subtle: #EDF2F7;

    --color-text-main: #0F172A;
    --color-text-secondary: #64748B;
    --color-text-muted: #94A3B8;

    /* Account Specific Brand Tints */
    --brand-instapay: #5E1B60;
    --brand-vodafone: #E60000;
    --brand-savings: #0D9488;

    /* Spacing & Radii */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    /* Elevation & Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 10px 25px -3px rgba(15, 23, 42, 0.12);
    --shadow-nav: 0 -4px 16px rgba(0, 0, 0, 0.06);

    /* Typography */
    --font-family: 'Cairo', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --transition-fast: 0.18s ease;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    direction: rtl;
    text-align: right;
    background-color: var(--color-bg);
    color: var(--color-text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Mobile Frame Container: Mobile-first 360-480px, centered on larger screens */
.app-viewport-wrapper {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    min-height: 100vh;
    background-color: var(--color-bg);
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.04);
}

/* Main Content Area with bottom padding for mobile navbar */
.main-content {
    flex: 1;
    padding: 16px 16px 90px 16px;
}

/* View Sections */
.view-section {
    display: none;
    animation: fadeIn 0.22s ease-in-out;
}

.view-section.active {
    display: block;
}

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

/* Typography Helpers */
h1, h2, h3, h4 {
    font-weight: 700;
    color: var(--color-text-main);
}

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

button {
    font-family: var(--font-family);
    cursor: pointer;
    border: none;
    outline: none;
    background: none;
}

/* Accessibility Focus States */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Toast Notifications */
.app-toast {
    position: fixed;
    bottom: 84px;
    left: 50%;
    transform: translateX(-50%) translateY(30px);
    background-color: var(--color-text-main);
    color: #FFFFFF;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 90%;
    text-align: center;
}

.app-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.app-toast.error {
    background-color: var(--color-outgoing);
}

.app-toast.success {
    background-color: var(--color-incoming);
}

