/* ========================================
   OneGo Post Mobile - Design Tokens
   ======================================== */

:root {
    /* Brand Colors */
    --color-primary: #00695C;
    --color-primary-dark: #004D40;
    --color-primary-light: #00796B;
    --color-primary-50: #E0F2F1;
    --color-primary-100: #B2DFDB;

    /* Accent Gold */
    --color-accent: #C9A227;
    --color-accent-light: #D4AB2A;
    --color-accent-dark: #B8941F;

    /* Functional Colors */
    --color-success: #4CAF50;
    --color-warning: #FF9800;
    --color-error: #F44336;
    --color-info: #2196F3;

    /* Purple for wallet */
    --color-purple: #7C3AED;
    --color-purple-light: #A78BFA;
    --color-purple-dark: #5B21B6;

    /* Text */
    --color-text: #212121;
    --color-text-secondary: #757575;
    --color-text-muted: #BDBDBD;
    --color-white: #FFFFFF;
    --color-white-80: rgba(255,255,255,0.8);
    --color-white-10: rgba(255,255,255,0.1);

    /* Backgrounds */
    --color-bg: #F5F5F5;
    --color-bg-card: #FFFFFF;
    --color-bg-warm: #FFF8E1;
    --color-border: #E0E0E0;
    --color-border-light: #F0F0F0;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --shadow-card: 0 2px 8px rgba(0,0,0,0.06);

    /* Spacing (mobile optimized) */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 20px;
    --space-2xl: 28px;
    --space-3xl: 36px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Typography */
    --font-family: 'Roboto', 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-xs: 11px;
    --font-size-sm: 13px;
    --font-size-base: 15px;
    --font-size-lg: 17px;
    --font-size-xl: 20px;
    --font-size-2xl: 24px;
    --font-size-3xl: 30px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-slow: 0.35s ease;

    /* Bottom nav height */
    --bottom-nav-height: 64px;
    --header-height: 56px;
}

/* ========================================
   Global Reset & Base Styles
   ======================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
    overflow-x: hidden;
    padding-bottom: var(--bottom-nav-height);
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    font-size: inherit;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    outline: none;
}

/* Safe area for notch phones */
@supports (padding-top: env(safe-area-inset-top)) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
    }
}

/* ========================================
   Utility Classes
   ======================================== */
.text-primary { color: var(--color-primary); }
.text-accent { color: var(--color-accent); }
.text-muted { color: var(--color-text-muted); }
.text-secondary { color: var(--color-text-secondary); }

.bg-primary { background-color: var(--color-primary); }
.bg-accent { background-color: var(--color-accent); }
.bg-card { background-color: var(--color-bg-card); }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================
   Loading Spinner
   ======================================== */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    gap: var(--space-md);
    color: var(--color-text-secondary);
}

/* ========================================
   Toast Component
   ======================================== */
.toast-container {
    position: fixed;
    top: calc(var(--header-height) + var(--space-sm));
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    width: 90%;
    max-width: 360px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    color: white;
    font-size: var(--font-size-sm);
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(-12px);
    transition: all var(--transition-base);
    margin-bottom: var(--space-sm);
    pointer-events: auto;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast--success { background: linear-gradient(135deg, #4CAF50, #43A047); }
.toast--error { background: linear-gradient(135deg, #F44336, #E53935); }
.toast--info { background: linear-gradient(135deg, #2196F3, #1E88E5); }
.toast--warning { background: linear-gradient(135deg, #FF9800, #FB8C00); }

/* ========================================
   Empty State
   ======================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-3xl) var(--space-xl);
    text-align: center;
}

.empty-state__icon {
    font-size: 56px;
    margin-bottom: var(--space-lg);
    opacity: 0.4;
}

.empty-state__title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--space-sm);
}

.empty-state__desc {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    max-width: 260px;
    margin-bottom: var(--space-xl);
}

/* ========================================
   Bottom Navigation Bar
   ======================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--color-white);
    display: flex;
    align-items: center;
    justify-content: space-around;
    border-top: 1px solid var(--color-border);
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1;
    height: 100%;
    color: var(--color-text-muted);
    transition: color var(--transition-fast);
    position: relative;
    text-decoration: none;
    -webkit-user-select: none;
    user-select: none;
}

.nav-item svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    transition: all var(--transition-base);
}

.nav-item span {
    font-size: var(--font-size-xs);
    font-weight: 500;
    transition: all var(--transition-base);
}

.nav-item.active {
    color: var(--color-primary);
}

.nav-item.active svg {
    transform: scale(1.08);
}

.nav-item.active span {
    font-weight: 700;
}

.nav-badge {
    position: absolute;
    top: 4px;
    right: 50%;
    margin-right: -18px;
    min-width: 16px;
    height: 16px;
    background: var(--color-error);
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ========================================
   Page Header
   ======================================== */
.page-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: var(--color-white);
    padding: 0 var(--space-lg);
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.page-header__back {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    color: var(--color-white);
    transition: background var(--transition-fast);
    font-size: 22px;
    flex-shrink: 0;
}

.page-header__back:active {
    background: rgba(255,255,255,0.15);
}

.page-header__title {
    font-size: var(--font-size-lg);
    font-weight: 700;
    flex: 1;
    letter-spacing: 0.3px;
}

/* ========================================
   Card Component
   ======================================== */
.card {
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.card:active {
    transform: scale(0.98);
}

/* ========================================
   Status Badge
   ======================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
    line-height: 1.4;
}

.badge--primary { background: var(--color-primary-50); color: var(--color-primary); }
.badge--warning { background: #FFF3E0; color: #E65100; }
.badge--success { background: #E8F5E9; color: #2E7D32; }
.badge--error { background: #FFEBEE; color: #C62828; }
.badge--info { background: #E3F2FD; color: #1565C0; }
.badge--purple { background: #F3E8FF; color: #7C3AED; }

/* ========================================
   Tab Filter
   ======================================== */
.tab-filter {
    display: flex;
    background: var(--color-bg-card);
    border-radius: var(--radius-md);
    padding: 3px;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tab-filter::-webkit-scrollbar { display: none; }

.tab-item {
    flex: 1;
    text-align: center;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
    white-space: nowrap;
    transition: all var(--transition-fast);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.tab-item.active {
    background: var(--color-primary);
    color: var(--color-white);
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0,105,92,0.25);
}

/* ========================================
   Modal / Overlay
   ======================================== */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-sheet {
    background: var(--color-bg-card);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: var(--space-xl);
    transform: translateY(100%);
    transition: transform var(--transition-slow);
}

.overlay.show .modal-sheet {
    transform: translateY(0);
}

/* ========================================
   Animations
   ======================================== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.animate-fade-in-up {
    animation: fadeInUp 0.35s ease-out forwards;
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}
