/* Loading */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    color: var(--color-text-hint);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--color-bg-secondary);
    border-top-color: var(--color-button);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-bottom: var(--spacing-md);
}

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

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: var(--color-bg);
    border-top: 1px solid var(--color-bg-secondary);
    padding: 6px 0;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    z-index: 100;
    box-shadow: var(--shadow-elevated);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--color-text-hint);
    font-size: 10px;
    padding: 4px 0;
    position: relative;
    transition: color 0.2s;
}

.nav-item.active {
    color: var(--color-button);
}

.nav-icon {
    font-size: 20px;
    margin-bottom: 2px;
}

.nav-label {
    font-weight: 500;
}

.nav-badge {
    position: absolute;
    top: 0;
    right: 50%;
    transform: translateX(14px);
    background: var(--color-danger);
    color: white;
    font-size: 10px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    font-weight: 600;
}

/* Page container */
.page {
    padding: var(--spacing-md);
    animation: fadeIn 0.2s ease;
}

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

.page-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: var(--spacing-md);
}

/* Cards */
.card {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    box-shadow: var(--shadow-card);
}

.card-clickable {
    cursor: pointer;
    transition: transform 0.1s;
}

.card-clickable:active {
    transform: scale(0.98);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    width: 100%;
}

.btn:active {
    opacity: 0.8;
}

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

.btn-primary {
    background: var(--color-button);
    color: var(--color-button-text);
}

.btn-secondary {
    background: var(--color-bg-secondary);
    color: var(--color-text);
}

.btn-danger {
    background: var(--color-danger);
    color: white;
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
    width: auto;
}

/* Forms */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    font-size: 13px;
    color: var(--color-text-hint);
    margin-bottom: var(--spacing-xs);
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--color-bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 15px;
    background: var(--color-bg);
    color: var(--color-text);
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus {
    border-color: var(--color-button);
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-new {
    background: #e3f2fd;
    color: #1976d2;
}

.status-in_progress {
    background: #fff3e0;
    color: #f57c00;
}

.status-success {
    background: #e8f5e9;
    color: #388e3c;
}

.status-failed {
    background: #fce4ec;
    color: #c62828;
}

/* Lists */
.list-empty {
    text-align: center;
    padding: var(--spacing-lg) var(--spacing-md);
    color: var(--color-text-hint);
}

.list-empty-icon {
    font-size: 48px;
    margin-bottom: var(--spacing-sm);
}

/* Order card */
.order-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-info {
    flex: 1;
}

.order-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}

.order-meta {
    font-size: 13px;
    color: var(--color-text-hint);
}

.order-amount {
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    margin-left: var(--spacing-sm);
}

/* Product card */
.product-card {
    display: flex;
    gap: var(--spacing-sm);
}

.product-image {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-sm);
    background: var(--color-bg-secondary);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    object-fit: cover;
}

.product-info {
    flex: 1;
    min-width: 0;
}

.product-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}

.product-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-button);
}

.product-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* Quantity control */
.qty-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--color-bg-secondary);
    color: var(--color-text);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.qty-value {
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}

/* Chat */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-sm);
}

.chat-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-sm);
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.chat-message-outgoing {
    background: var(--color-button);
    color: var(--color-button-text);
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.chat-message-incoming {
    background: var(--color-bg);
    box-shadow: var(--shadow-card);
    border-bottom-left-radius: 4px;
}

.chat-message-time {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 4px;
    text-align: right;
}

.chat-input-area {
    display: flex;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--color-bg);
    border-top: 1px solid var(--color-bg-secondary);
}

.chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--color-bg-secondary);
    border-radius: 20px;
    font-size: 15px;
    outline: none;
    background: var(--color-bg-secondary);
    color: var(--color-text);
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: var(--color-button);
    color: var(--color-button-text);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Section list */
.section-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px var(--spacing-md);
}

.section-name {
    font-weight: 600;
    font-size: 15px;
}

.section-arrow {
    color: var(--color-text-hint);
    font-size: 18px;
}

/* Search */
.search-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--color-bg-secondary);
}

.search-input {
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    background: var(--color-bg);
    color: var(--color-text);
    outline: none;
}

/* Cart summary */
.cart-summary {
    position: sticky;
    bottom: 72px;
    background: var(--color-bg);
    padding: var(--spacing-md);
    border-top: 1px solid var(--color-bg-secondary);
    box-shadow: var(--shadow-elevated);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 17px;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    gap: var(--spacing-xs);
    font-size: 13px;
    color: var(--color-text-hint);
    margin-bottom: var(--spacing-sm);
    flex-wrap: wrap;
}

.breadcrumb-link {
    cursor: pointer;
    color: var(--color-link);
}

.breadcrumb-separator::after {
    content: '›';
    margin: 0 4px;
}

/* Detail page */
.detail-header {
    margin-bottom: var(--spacing-md);
}

.detail-title {
    font-size: 20px;
    font-weight: 700;
}

.detail-subtitle {
    font-size: 14px;
    color: var(--color-text-hint);
    margin-top: 4px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-bg-secondary);
    font-size: 14px;
}

.detail-label {
    color: var(--color-text-hint);
}

.detail-value {
    font-weight: 600;
}
