/* === GelKaravan POS Styles === */
:root {
    --bg: #0f0f1a;
    --surface: #1a1a2e;
    --surface2: #16213e;
    --primary: #0f3460;
    --accent: #e94560;
    --success: #00b894;
    --warning: #fdcb6e;
    --danger: #d63031;
    --text: #f0f0f0;
    --text2: #a0a0b0;
    --border: #2a2a4a;
    --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

#app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo { font-size: 18px; font-weight: 700; }

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}
.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--danger); animation: pulse 1.5s infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.header-right {
    font-size: 14px;
    color: var(--text2);
    font-weight: 600;
}

/* Sections */
.section {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.section-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text2);
    margin-bottom: 8px;
}

/* Scanner */
.scanner-container {
    width: 100%;
    height: 200px;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    display: none;
}

.scanner-container.active { display: block; }

.scanner-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanner-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scanner-frame {
    width: 70%;
    height: 50px;
    border: 2px solid var(--accent);
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(233, 69, 96, 0.3);
}

.scanner-controls {
    margin-top: 8px;
}

/* Manual input */
.manual-input {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.manual-input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 16px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    touch-action: manipulation;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:active { background: #1a5a9e; }
.btn-secondary { background: var(--surface2); color: var(--text); }
.btn-success { background: var(--success); color: white; }
.btn-success:disabled { background: #006d55; opacity: 0.5; }
.btn-danger { background: var(--danger); color: white; }
.btn-large { padding: 14px 24px; font-size: 16px; width: 100%; }
.btn-full { width: 100%; }
.btn-icon {
    background: none;
    border: none;
    color: var(--text2);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
}

/* Counteragent */
.counteragent-input {
    position: relative;
}

.counteragent-input input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 16px;
}

.dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    max-height: 200px;
    overflow-y: auto;
    z-index: 50;
}

.dropdown-item {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}

.dropdown-item:active { background: var(--primary); }

.counteragent-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--surface2);
    border-radius: var(--radius);
    border: 1px solid var(--success);
}

/* Items List */
.items-list {
    max-height: calc(100vh - 450px);
    overflow-y: auto;
}

.item-card {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    gap: 10px;
}

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

.item-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-barcode {
    font-size: 12px;
    color: var(--text2);
}

.item-price {
    font-size: 13px;
    color: var(--success);
}

.item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
}

.item-qty-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface2);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-qty-val {
    font-size: 16px;
    font-weight: 600;
    min-width: 28px;
    text-align: center;
}

.item-remove {
    color: var(--danger);
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
}

.empty-state {
    text-align: center;
    color: var(--text2);
    padding: 30px 0;
    font-size: 14px;
}

/* Footer */
.footer {
    padding: 12px 16px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.footer-total {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text2);
}

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    width: 90%;
    max-width: 320px;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.modal-subtitle {
    font-size: 13px;
    color: var(--text2);
    margin-bottom: 16px;
}

.qty-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
}

.qty-controls input {
    width: 80px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 8px;
}

.btn-qty {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text);
    font-size: 24px;
    cursor: pointer;
}

.modal-actions {
    display: flex;
    gap: 8px;
}

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

/* Toast */
#toast-container {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    animation: slideIn 0.3s ease;
    white-space: nowrap;
}

.toast-success { background: var(--success); color: white; }
.toast-error { background: var(--danger); color: white; }
.toast-warning { background: var(--warning); color: #333; }
.toast-info { background: var(--primary); color: white; }

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
