@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Sarabun:wght@300;400;500;600;700;800&display=swap');

/* 
 * PDA IT78 Premium Dark Theme - 5.5 inch Optimized
 * ออกแบบหน้าตาเรียบหรู ทันสมัย ดูเป็นมืออาชีพ ถนอมสายตา และใช้งานง่าย
 */

:root {
    --primary: #6366f1;         /* Hyper Indigo */
    --primary-dark: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.15);
    --success: #10b981;         /* Vivid Emerald */
    --success-light: rgba(16, 185, 129, 0.15);
    --warning: #fbbf24;         /* Bright Amber */
    --warning-light: rgba(251, 191, 36, 0.15);
    --danger: #f43f5e;          /* Coral Rose */
    --danger-light: rgba(244, 63, 94, 0.15);
    --bg-main: #09090b;         /* Pure Obsidian Dark */
    --bg-card: rgba(20, 20, 27, 0.6); /* Obsidian Glass Card */
    --bg-input: rgba(12, 12, 18, 0.85); /* Dark Input */
    --text-primary: #f4f4f5;    /* Premium White-Gray */
    --text-secondary: #a1a1aa;  /* Zinc Gray */
    --text-muted: #71717a;      /* Darker Zinc Gray */
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.16);
    --border-focus: #6366f1;
    --shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.05);
    --radius-lg: 20px;          /* Softer rounded corners */
    --radius-md: 14px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

body {
    font-family: 'Plus Jakarta Sans', 'Sarabun', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: radial-gradient(circle at 50% 0%, #1e1b4b 0%, #09090b 70%) no-repeat fixed;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    width: 100%;
    margin: 0 auto;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

/* Header - Modern Glassmorphism with Gradient */
.header {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.header-title {
    font-size: 20px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.5px;
    color: #ffffff;
}

.header-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-subtitle span {
    color: #ffffff;
    font-weight: 700;
}

/* Container */
.container {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 500px;
    margin: 0 auto;
}

/* Card - Premium Neumorphic dark */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
}

.card:hover {
    border-color: var(--border-hover);
}

.card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.75px;
}

/* Input Group */
.input-group {
    display: flex;
    gap: 10px;
}

.input-field {
    flex: 1;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    transition: var(--transition);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.input-field:focus {
    outline: none;
    border-color: var(--border-focus);
    background: rgba(12, 12, 18, 0.95);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25), inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.input-field::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

/* Buttons */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    min-height: 50px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.96);
}

.btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.08);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.btn:hover::after {
    opacity: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.25);
}

.btn-danger {
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    color: white;
    box-shadow: 0 4px 15px rgba(244, 63, 94, 0.25);
}

.btn-block {
    width: 100%;
}

.btn-lg {
    min-height: 54px;
    font-size: 16px;
}

.btn-icon {
    width: 50px;
    padding: 0;
    font-size: 18px;
}

/* Product Info Card */
.product-info {
    background: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.product-barcode {
    font-size: 14px;
    color: var(--primary);
    font-weight: 700;
    font-family: monospace;
    margin-bottom: 6px;
    letter-spacing: 1px;
}

.product-name {
    font-size: 17px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.5;
}

/* Quantity Input Area */
.qty-input-group {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: center;
    margin: 16px 0;
}

.qty-btn {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    border: none;
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.qty-btn:active {
    transform: scale(0.9);
}

.qty-btn.minus {
    background: var(--danger-light);
    color: var(--danger);
    border: 1.5px solid rgba(239, 68, 68, 0.25);
}

.qty-btn.plus {
    background: var(--success-light);
    color: var(--success);
    border: 1.5px solid rgba(16, 185, 129, 0.25);
}

.qty-input {
    width: 130px;
    height: 56px;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: 16px;
    text-align: center;
    font-size: 26px;
    font-weight: 800;
    color: var(--text-primary);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.25);
    transition: var(--transition);
}

.qty-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25), inset 0 2px 4px rgba(0,0,0,0.25);
}

/* Action Buttons Grid */
.action-row {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.action-row .btn {
    flex: 1;
}

/* Recent List */
.recent-list {
    max-height: 240px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.recent-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: var(--bg-input);
    border-radius: 10px;
    border: 1px solid var(--border);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.recent-item:hover {
    border-color: var(--border-hover);
}

.recent-item .barcode {
    font-family: monospace;
    color: var(--primary);
    font-weight: 700;
}

.recent-item .name {
    flex: 1;
    margin-left: 10px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.recent-item .qty {
    font-weight: 800;
    color: var(--success);
    background: var(--success-light);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 13px;
}

/* Status Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

/* Toast Messages */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    z-index: 1000;
    animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 90%;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.toast-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.toast-error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(11, 15, 25, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3.5px solid rgba(255, 255, 255, 0.08);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.5, 0.1, 0.4, 0.9) infinite;
}

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

/* Login Page Layout */
.login-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 90vh;
    padding: 24px;
    max-width: 420px;
    margin: 0 auto;
}

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

.login-logo .icon {
    font-size: 72px;
    margin-bottom: 16px;
    display: inline-block;
    filter: drop-shadow(0 4px 10px rgba(99, 102, 241, 0.2));
}

.login-logo h1 {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 14px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-form .input-field {
    width: 100%;
}

/* Session Select */
.session-select {
    width: 100%;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 18px;
    transition: var(--transition);
}

.session-select:focus {
    outline: none;
    border-color: var(--border-focus);
    background-color: var(--bg-input);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

/* Stats Row Grid */
.stats-row {
    display: flex;
    gap: 10px;
    margin-bottom: 4px;
}

.stat-item {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 10px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.stat-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 36px 20px;
    color: var(--text-secondary);
}

.empty-state .icon {
    font-size: 52px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

/* Product Info Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(7, 10, 18, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
    animation: overlayFadeIn 0.2s ease-out;
}

.modal-content {
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
    transform-origin: center;
    animation: modalScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalScaleIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Responsive adjustments for smaller screens (like PDA IT68 with 4.0 - 4.7 inch display) */
@media (max-width: 375px) {
    :root {
        --radius-lg: 16px;
        --radius-md: 10px;
    }
    
    .container {
        padding: 10px;
        gap: 10px;
    }
    
    .card {
        padding: 14px 16px;
    }
    
    .header {
        padding: 12px 16px;
    }
    
    .header-title {
        font-size: 18px;
    }
    
    /* Shrink quantity controls to fit narrow screens */
    .qty-input-group {
        gap: 10px;
    }
    
    .qty-btn {
        width: 48px;
        height: 48px;
        font-size: 20px;
        border-radius: 12px;
    }
    
    .qty-input {
        width: 100px;
        height: 48px;
        font-size: 22px;
        border-radius: 12px;
    }
    
    /* Adjust buttons size */
    .btn {
        min-height: 44px;
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .btn-icon {
        width: 44px;
    }
    
    /* Adjust stats grid */
    .stats-row {
        gap: 6px;
    }
    
    .stat-item {
        padding: 10px 6px;
    }
    
    .stat-value {
        font-size: 18px;
    }
    
    .stat-label {
        font-size: 10px;
    }
    
    /* Adjust recent items text limits */
    .recent-item .name {
        max-width: 140px;
    }
    
    .recent-item .barcode {
        font-size: 13px;
    }
}

