/* ============================================
   Top Seller - Main Application Styles
   Mobile-first responsive framework
   ============================================ */

/* CSS Variables */
:root {
    --color-primary: #6366f1;
    --color-primary-dark: #4f46e5;
    --color-primary-light: #818cf8;
    --color-white: #FFFFFF;
    --color-bg: #090d16;
    --color-red: #ef4444;
    --color-red-dark: #dc2626;
    --color-green: #10b981;
    --color-green-dark: #059669;
    --color-text: #f8fafc;
    --color-text-secondary: #94a3b8;
    --color-text-muted: #475569;
    --color-border: #1f2937;
    --color-border-light: #374151;
    --color-card-bg: #111827;
    --color-blue-gradient-start: #6366f1;
    --color-blue-gradient-end: #4f46e5;
    --color-dark-gradient-start: #1f2937;
    --color-dark-gradient-end: #111827;
    --color-gold-gradient-start: #f59e0b;
    --color-gold-gradient-end: #d97706;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --header-height: 50px;
    --nav-height: 56px;
    --font-stack: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    overflow-x: hidden !important;
    max-width: 100vw;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: var(--font-stack);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    outline: none;
}

input, select, textarea {
    font-family: inherit;
    font-size: 1rem;
    outline: none;
}

img {
    max-width: 100%;
    display: block;
}

/* App Container - Desktop centering */
body {
    display: flex;
    justify-content: center;
}

#app-content {
    width: 100%;
    max-width: 480px;
    position: relative;
}

/* Header */
.app-header {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: var(--header-height);
    background: var(--color-card-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    z-index: 1000;
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.header-back {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text);
    border-radius: 50%;
    transition: background 0.2s;
}

.header-back:active {
    background: rgba(0,0,0,0.06);
}

.header-back .material-icons-round {
    font-size: 22px;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
    text-align: center;
}

.header-actions {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 8px;
}

/* Content Area */
.app-content {
    padding-top: var(--header-height);
    padding-bottom: var(--nav-height);
    min-height: 100vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Page transition */
.page {
    animation: fadeInPage 0.25s ease-out;
    padding: 12px;
}

@keyframes fadeInPage {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: var(--nav-height);
    background: var(--color-card-bg);
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--color-text-muted);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 2px;
}

.nav-item:active {
    transform: scale(0.9);
}

.nav-item .material-icons-round {
    font-size: 24px;
    transition: transform 0.2s ease;
}

.nav-label {
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.nav-item.active {
    color: var(--color-primary);
}

.nav-item.active .material-icons-round {
    transform: translateY(-2px);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(9, 13, 22, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 90%;
    max-width: 400px;
    pointer-events: none;
}

.toast {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    animation: slideInToast 0.3s ease-out;
    pointer-events: auto;
    box-shadow: var(--shadow-md);
}

.toast.success { background: var(--color-green); }
.toast.error { background: var(--color-red); }
.toast.info { background: #2196F3; }

.toast.removing {
    animation: slideOutToast 0.3s ease-in forwards;
}

@keyframes slideInToast {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideOutToast {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}

/* Utility Classes - Text */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-blue { color: var(--color-primary); }
.text-red { color: var(--color-red); }
.text-green { color: var(--color-green); }
.text-gray { color: var(--color-text-secondary); }
.text-muted { color: var(--color-text-muted); }
.text-dark { color: var(--color-text); }
.text-white { color: var(--color-white); }

/* Utility Classes - Font Weight */
.fw-normal { font-weight: 400; }
.fw-medium { font-weight: 500; }
.fw-bold { font-weight: 600; }
.fw-extra { font-weight: 700; }

/* Utility Classes - Font Size */
.fs-10 { font-size: 10px; }
.fs-11 { font-size: 11px; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-14 { font-size: 14px; }
.fs-15 { font-size: 15px; }
.fs-16 { font-size: 16px; }
.fs-18 { font-size: 18px; }
.fs-20 { font-size: 20px; }
.fs-24 { font-size: 24px; }
.fs-28 { font-size: 28px; }
.fs-32 { font-size: 32px; }

/* Utility Classes - Margin Top */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.mt-6 { margin-top: 24px; }

/* Utility Classes - Margin Bottom */
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }

/* Utility Classes - Padding */
.p-0 { padding: 0; }
.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-5 { padding: 20px; }

.px-2 { padding-left: 8px; padding-right: 8px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.px-4 { padding-left: 16px; padding-right: 16px; }

.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }

/* Utility Classes - Flex */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.flex-1 { flex: 1; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

/* Utility Classes - Display */
.d-none { display: none !important; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }

/* Utility Classes - Width/Height */
.w-full { width: 100%; }
.h-full { height: 100%; }

/* Utility - Rounded */
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: 9999px; }

/* Utility - Background */
.bg-white { background: var(--color-white); }
.bg-blue { background: var(--color-primary); }
.bg-red { background: var(--color-red); }
.bg-green { background: var(--color-green); }
.bg-gray { background: var(--color-bg); }

/* Utility - Shadow */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }

/* Form Styles */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 6px;
}

.input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-card-bg);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input::placeholder {
    color: var(--color-text-secondary);
    opacity: 0.6;
}

.input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.input-group {
    display: flex;
    align-items: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-card-bg);
    overflow: hidden;
}

.input-group .input-group-addon {
    padding: 0 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-secondary);
    border-right: 1px solid var(--color-border);
    background: var(--color-bg);
    white-space: nowrap;
}

.input-group .input {
    border: none;
    box-shadow: none;
    border-radius: 0;
    flex: 1;
}

.input-group .input-group-action {
    padding: 0 12px;
    color: var(--color-primary);
    font-size: 13px;
    font-weight: 500;
}

.select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-card-bg);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' 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 12px center;
    padding-right: 36px;
}

.select:focus {
    border-color: var(--color-primary);
}

textarea.input {
    resize: vertical;
    min-height: 80px;
}

/* Page specific no-padding */
.page-no-pad {
    padding: 0;
}

.page-no-pad .page-section {
    padding: 12px;
}

/* Scrollable hide scrollbar */
.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

/* Responsive desktop */
@media (min-width: 481px) {
    body {
        background: #060814;
    }
    .app-content {
        background: var(--color-bg);
        min-height: 100vh;
    }
}
