/* Mitovail - Mobile-First CSS */

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #0ea5e9;
    --accent-hover: #38bdf8;
    --success: #22c55e;
    --warning: #eab308;
    --error: #ef4444;
    --border: #334155;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-img {
    height: 36px;
    width: auto;
}

.logo-icon-img {
    height: 32px;
    width: auto;
}

.logo-text-styled {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-primary);
}

.auth-logo-img {
    height: 48px;
    width: auto;
    margin-bottom: 16px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cart-btn, .account-btn {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.cart-btn:hover, .account-btn:hover {
    background: var(--border);
}

.cart-count {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.cart-count:empty, .cart-count[data-count="0"] {
    display: none;
}

.login-btn {
    padding: 10px 16px;
    background: var(--accent);
    color: white;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 14px;
    transition: background 0.2s;
}

.login-btn:hover {
    background: var(--accent-hover);
}

/* Quick Links (Full-width bars) */
.quick-links {
    display: flex;
    flex-direction: column;
}

.quick-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    transition: background 0.2s;
}

.quick-link:hover {
    background: var(--bg-card);
}

.quick-link svg {
    flex-shrink: 0;
}

.quick-link-active {
    color: var(--success);
}

.quick-link-locked {
    color: var(--text-secondary);
}

.quick-link-locked .lock-icon {
    margin-left: 4px;
    opacity: 0.6;
}

/* Category Tabs */
.category-tabs {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar {
    display: none;
}

.tabs-scroll {
    display: flex;
    padding: 8px 16px;
    gap: 8px;
    min-width: max-content;
}

.tab {
    padding: 8px 16px;
    background: var(--bg-primary);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.tab:hover {
    background: var(--border);
}

.tab.active {
    background: var(--tab-color, var(--accent));
    color: white;
}

/* Main Content */
.main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}

.category-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-left: 12px;
    border-left: 4px solid var(--accent);
}

/* Product Grid - 2 columns on mobile */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 640px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

@media (min-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
}

/* Product Card */
.product-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.product-card:active {
    transform: scale(0.98);
}

.product-image {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-placeholder {
    font-size: 32px;
    font-weight: 800;
    opacity: 0.5;
}

.product-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.product-category {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.product-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
    margin-top: auto;
}

.product-variants {
    font-size: 11px;
    color: var(--text-muted);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.empty-state p {
    margin-bottom: 16px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

/* Footer */
.footer {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-muted);
    font-size: 12px;
    border-top: 1px solid var(--border);
    margin-top: 32px;
}

/* Product Detail Page */
.product-detail {
    max-width: 600px;
    margin: 0 auto;
}

.product-hero {
    aspect-ratio: 1;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    margin-bottom: 24px;
    overflow: hidden;
}

.product-hero img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 20px;
}

.product-hero-placeholder {
    font-size: 64px;
    font-weight: 800;
    opacity: 0.3;
}

.product-detail-info {
    padding: 0 4px;
}

.product-detail-category {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.product-detail-name {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.product-detail-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
    line-height: 1.6;
}

/* Variant Selector */
.variant-section {
    margin-bottom: 24px;
}

.variant-label {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.variant-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.variant-btn {
    padding: 12px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.variant-btn:hover {
    border-color: var(--accent);
}

.variant-btn.selected {
    border-color: var(--accent);
    background: rgba(14, 165, 233, 0.1);
}

.variant-size {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.variant-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
    margin-top: 4px;
}

/* Quantity Selector */
.quantity-section {
    margin-bottom: 24px;
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.qty-btn {
    width: 44px;
    height: 44px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.qty-btn:hover {
    background: var(--border);
}

.qty-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.qty-value {
    font-size: 18px;
    font-weight: 600;
    min-width: 40px;
    text-align: center;
}

/* Add to Cart */
.add-to-cart-section {
    position: sticky;
    bottom: 0;
    background: var(--bg-primary);
    padding: 16px 0;
    border-top: 1px solid var(--border);
    margin-top: 24px;
}

.add-to-cart-btn {
    width: 100%;
    padding: 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.add-to-cart-btn:hover {
    background: var(--accent-hover);
}

.add-to-cart-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Cart Page */
.cart-page {
    max-width: 600px;
    margin: 0 auto;
}

.cart-links {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.cart-link {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    transition: all 0.2s;
}

.cart-link:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
    color: var(--accent);
}

.cart-link-active {
    border-color: var(--success);
    color: var(--success);
}

.cart-link-active:hover {
    border-color: var(--success);
    color: var(--success);
}

.cart-link-disabled {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

.cart-link-disabled .lock-icon {
    margin-left: 4px;
}

.cart-empty {
    text-align: center;
    padding: 48px 24px;
}

.cart-empty svg {
    width: 64px;
    height: 64px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cart-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg-card);
    border-radius: var(--radius);
}

.cart-item-image {
    width: 80px;
    height: 80px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.cart-item-placeholder {
    font-size: 24px;
    font-weight: 800;
    opacity: 0.3;
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-weight: 600;
    margin-bottom: 2px;
}

.cart-item-variant {
    font-size: 13px;
    color: var(--text-secondary);
}

.cart-item-price {
    font-weight: 600;
    color: var(--accent);
    margin-top: 4px;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-item-qty button {
    width: 28px;
    height: 28px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    cursor: pointer;
}

.cart-item-qty span {
    min-width: 24px;
    text-align: center;
    font-weight: 600;
}

.cart-item-remove {
    margin-left: auto;
    color: var(--error);
    font-size: 13px;
    cursor: pointer;
}

/* Cart Summary */
.cart-summary {
    margin-top: 24px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
}

.summary-row.total {
    border-top: 1px solid var(--border);
    margin-top: 8px;
    padding-top: 16px;
    font-size: 18px;
    font-weight: 700;
}

.summary-row.total .value {
    color: var(--accent);
}

.checkout-btn {
    margin-top: 16px;
}

/* Back Link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
}

.back-link:hover {
    color: var(--text-primary);
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 16px;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Page Header */
.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    border: 1px solid var(--border);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    border-color: var(--success);
}

/* Login Page */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 32px 24px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo .logo-icon {
    width: 64px;
    height: 64px;
    font-size: 32px;
    margin: 0 auto 12px;
}

.auth-logo h1 {
    font-size: 24px;
}

.auth-title {
    font-size: 20px;
    text-align: center;
    margin-bottom: 24px;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--accent);
}

/* Checkout */
.checkout-section {
    margin-bottom: 32px;
}

.checkout-section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

#checkout-container {
    min-height: 400px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

/* Account Page */
.account-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
}

.user-name {
    font-size: 18px;
    font-weight: 600;
}

.user-email {
    font-size: 13px;
    color: var(--text-secondary);
}

.tracker-card {
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    color: white;
}

.tracker-card h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.tracker-card p {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 16px;
}

.tracker-card .btn {
    background: white;
    color: var(--accent);
}

.tracker-card.expired {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.tracker-card.expired .btn {
    background: var(--accent);
    color: white;
}

/* Orders List */
.orders-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.order-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.order-number {
    font-weight: 600;
}

.order-date {
    font-size: 13px;
    color: var(--text-secondary);
}

.order-status {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.order-status.pending { background: #fbbf24; color: #000; }
.order-status.paid { background: #3b82f6; color: #fff; }
.order-status.processing { background: #8b5cf6; color: #fff; }
.order-status.shipped { background: #06b6d4; color: #fff; }
.order-status.delivered { background: #22c55e; color: #fff; }
.order-status.cancelled { background: #ef4444; color: #fff; }

.order-total {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}

.order-items-preview {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Utilities */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
