/* ============================================
   BISWEB SALES - MOBILE-FIRST STYLES
   ============================================ */

:root {
    --primary: #7c3aed;
    --primary-dark: #6d28d9;
    --primary-light: #a78bfa;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1f2937;
    --gray: #6b7280;
    --gray-light: #f3f4f6;
    --white: #ffffff;
    --radius: 12px;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-light);
    color: var(--dark);
    height: 100%;
    overflow-x: hidden;
}

/* Screens */
.screen {
    min-height: 100vh;
    display: none;
}

.screen.active,
#loginScreen:not([style*="none"]),
#registerScreen:not([style*="none"]),
#mainApp:not([style*="none"]) {
    display: flex;
    flex-direction: column;
}

#mainApp {
    padding-bottom: 70px;
    height: 100vh;
}

/* ============================================
   LOGIN / REGISTER
   ============================================ */
#loginScreen, #registerScreen {
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px 24px;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 12px;
}

.login-logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark);
}

.login-logo p {
    color: var(--gray);
    font-size: 14px;
    margin-top: 4px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 6px;
}

.form-input, .form-select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    background: var(--white);
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:active {
    background: var(--primary-dark);
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--gray-light);
    color: var(--dark);
}

.btn-secondary:active {
    background: #e5e7eb;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 8px;
}

.btn-lg {
    padding: 16px 24px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--white);
    font-size: 18px;
    padding: 8px;
    cursor: pointer;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--gray);
}

.login-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: var(--gray);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper .form-input {
    padding-right: 44px;
}

.toggle-password {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--gray);
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   APP HEADER
   ============================================ */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--primary);
    color: var(--white);
    position: sticky;
    top: 0;
    z-index: 10;
}

.app-header h1 {
    font-size: 20px;
    font-weight: 700;
}

/* ============================================
   APP CONTENT
   ============================================ */
.app-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

/* ============================================
   STATS ROW
   ============================================ */
.stats-row {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    flex: 1;
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-value {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 12px;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   SECTION HEADER
   ============================================ */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.section-header h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--dark);
}

.section-header h2 i {
    color: var(--primary);
    margin-right: 6px;
}

/* ============================================
   CARD LIST
   ============================================ */
.card-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card-item {
    background: var(--white);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-item-info {
    flex: 1;
}

.card-item-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--dark);
}

.card-item-meta {
    font-size: 13px;
    color: var(--gray);
    margin-top: 4px;
}

.card-item-meta span {
    margin-right: 10px;
}

.card-item-right {
    text-align: right;
}

.card-item-amount {
    font-weight: 700;
    font-size: 15px;
    color: var(--primary);
}

.card-item-date {
    font-size: 12px;
    color: var(--gray);
    margin-top: 2px;
}

/* ============================================
   PRODUCT CARD
   ============================================ */
.product-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 14px;
}

.product-icon {
    width: 44px;
    height: 44px;
    background: var(--primary-light);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 18px;
    flex-shrink: 0;
}

.product-info {
    flex: 1;
}

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

.product-details {
    font-size: 13px;
    color: var(--gray);
    margin-top: 2px;
}

.product-stock {
    font-size: 13px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    flex-shrink: 0;
}

.stock-in {
    background: #d1fae5;
    color: #065f46;
}

.stock-low {
    background: #fef3c7;
    color: #92400e;
}

.stock-out {
    background: #fee2e2;
    color: #991b1b;
}

/* ============================================
   REQUEST LIST
   ============================================ */
.request-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.request-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--warning);
}

.request-card.fulfilled {
    border-left-color: var(--success);
}

.request-card.cancelled {
    border-left-color: var(--gray);
    opacity: 0.7;
}

.request-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.request-product {
    font-weight: 600;
    font-size: 15px;
}

.request-status {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-fulfilled {
    background: #d1fae5;
    color: #065f46;
}

.status-cancelled {
    background: #e5e7eb;
    color: var(--gray);
}

.request-body {
    font-size: 13px;
    color: var(--gray);
    line-height: 1.5;
}

.request-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.request-actions .btn {
    flex: 1;
    padding: 8px;
    font-size: 13px;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray);
}

.empty-state i {
    font-size: 40px;
    margin-bottom: 12px;
    display: block;
    color: #d1d5db;
}

.empty-state p {
    font-size: 14px;
}

/* ============================================
   BOTTOM NAVIGATION
   ============================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: var(--white);
    border-top: 1px solid #e5e7eb;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0 8px;
    background: none;
    border: none;
    color: var(--gray);
    font-size: 11px;
    cursor: pointer;
    transition: color 0.2s;
}

.nav-item i {
    font-size: 20px;
    margin-bottom: 3px;
}

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

.nav-item:active {
    opacity: 0.7;
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 0;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: var(--gray-light);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    color: var(--gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.modal-footer .btn {
    flex: 1;
}

/* ============================================
   TOAST
   ============================================ */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--dark);
    color: var(--white);
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 300;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}

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

/* ============================================
   RESPONSIVE
   ============================================ */
@media (min-width: 768px) {
    .app-content {
        max-width: 480px;
        margin: 0 auto;
        width: 100%;
    }
}
