:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-input: #f1f5f9;
    --border-color: #e2e8f0;
    --border-active: #ef4444;
    
    --primary: #ef4444;
    --primary-hover: #dc2626;
    --secondary: #10b981;
    --secondary-hover: #059669;
    --warning: #f59e0b;
    --text-main: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05), 0 2px 8px -1px rgba(0, 0, 0, 0.03);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 10px;
}

/* Button & interactive states */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    color: white;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(225, 29, 72, 0.4);
}
.btn-primary:active {
    transform: translateY(0);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}
.btn-outline:hover {
    background: rgba(0, 0, 0, 0.05);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
}
.btn-icon:hover {
    color: var(--primary);
    background: rgba(0, 0, 0, 0.05);
}

/* Login Page */
#login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-main);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

#login-container.active {
    opacity: 1;
    pointer-events: auto;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px 30px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
    animation: fadeInUp 0.6s ease;
}

.logo-area {
    text-align: center;
    margin-bottom: 30px;
}

.logo-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 15px;
    animation: pulse 2s infinite;
}

.logo-area h1 {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(to right, #f43f5e, #fb7185);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
}

.logo-area p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Inputs and Forms */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    width: 100%;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-group input, .input-group select {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.input-group input:focus, .input-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

/* Dashboard Container */
#dashboard-container {
    display: none;
    flex-direction: column;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: 50px;
}

#dashboard-container.active {
    display: flex;
}

/* Header */
header {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-icon {
    font-size: 2.2rem;
    color: var(--text-secondary);
}

.header-left h2 {
    font-size: 1rem;
    font-weight: 600;
}

.header-left p {
    font-size: 0.75rem;
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}
.header-left p::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--secondary);
    animation: flash 1.5s infinite;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    background-color: #f1f5f9;
    margin: 16px;
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 12px 8px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: calc(var(--radius-md) - 2px);
    cursor: pointer;
    transition: var(--transition);
}

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

.badge {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 20px;
    font-weight: 700;
}

/* Tab Content Panes */
.tab-content {
    padding: 0 16px;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-pane.active {
    display: block;
}

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

.section-header h3 {
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Cards & Grid */
.cards-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.order-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
    transition: var(--transition);
}

.order-card:hover {
    border-color: rgba(255,255,255,0.15);
}

.order-card-header {
    background-color: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-code {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.95rem;
}

.order-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.order-card-body {
    padding: 16px;
}

.customer-info {
    margin-bottom: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ticket-item {
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 10px;
}

.ticket-item:last-child {
    margin-bottom: 0;
}

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

/* Game Badges */
.game-badge {
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.game-mega { background-color: #b91c1c; color: white; }
.game-power { background-color: #ef4444; color: white; }
.game-lotto { background-color: #2563eb; color: white; }
.game-max3d { background-color: #d97706; color: white; }
.game-max3dplus { background-color: #c2410c; color: white; }
.game-max3dpro { background-color: #7c3aed; color: white; }
.game-xskt { background-color: #059669; color: white; }

.draw-id {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.ticket-numbers {
    font-family: monospace;
    font-size: 1.15rem;
    font-weight: 700;
    color: #fbbf24;
    letter-spacing: 2px;
    padding: 4px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.number-ball {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fef08a;
    border: 2px solid #eab308;
    color: #854d0e;
    font-weight: 700;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 0.95rem;
}

.special-ball {
    background: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
}

.ticket-playtype {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.order-card-footer {
    padding: 12px 16px;
    background-color: transparent;
    border-top: 1px solid var(--border-color);
}

/* Form Styles */
.form-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.form-container h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
}

.form-row {
    display: flex;
    gap: 16px;
}

@media(max-width: 480px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
}

.file-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: var(--bg-input);
    border: 1px dashed var(--border-color);
    color: var(--text-secondary);
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition);
}

.file-upload-label:hover {
    border-color: var(--primary);
    color: var(--text-main);
}

/* Image Preview Container */
.image-preview-container {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 20px;
    max-height: 200px;
}

.image-preview-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    display: block;
}

.btn-close-preview {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
}

.hidden {
    display: none !important;
}

/* Tables */
.list-container-title {
    margin-top: 10px;
    margin-bottom: 12px;
}
.list-container-title h3 {
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.xskt-list-table-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 30px;
}

.responsive-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

.responsive-table th, .responsive-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.responsive-table th {
    background-color: #f8fafc;
    font-weight: 600;
    color: var(--text-secondary);
}

.responsive-table tr:last-child td {
    border-bottom: none;
}

.table-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 30px !important;
}

.table-thumbnail {
    width: 45px;
    height: 35px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.btn-danger-sm {
    background: transparent;
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}
.btn-danger-sm:hover {
    background: #ef4444;
    color: white;
}

/* Empty & Loading states */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 2.5rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.empty-state p {
    font-size: 0.9rem;
}

/* Modal View */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.9);
}

.modal.active {
    display: block;
}

.modal-content {
    margin: auto;
    display: block;
    width: 90%;
    max-width: 500px;
    border-radius: 8px;
    animation: zoom 0.3s ease;
}

@keyframes zoom {
    from {transform:scale(0)}
    to {transform:scale(1)}
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.close-modal:hover,
.close-modal:focus {
    color: var(--primary);
    text-decoration: none;
}

#modal-caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 15px 0;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

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

/* --- Branding Logo --- */
.logo-img {
    max-width: 100%;
    height: auto;
    max-height: 70px;
    object-fit: contain;
    margin-bottom: 12px;
}

.header-logo-img {
    height: 40px;
    max-width: 120px;
    object-fit: contain;
}

/* --- Product Filters --- */
.filter-wrapper {
    margin-bottom: 16px;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
}

.filter-wrapper::-webkit-scrollbar {
    display: none;
}

.product-filters {
    display: flex;
    gap: 8px;
    white-space: nowrap;
    width: max-content;
    padding: 2px;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.filter-pill:hover {
    border-color: var(--primary);
    color: var(--text-main);
}

.filter-pill.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

.pill-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.08);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 10px;
    transition: var(--transition);
}

.filter-pill.active .pill-badge {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

/* --- Summary Ticket Counter --- */
.summary-box {
    background-color: #fef3c7;
    border: 1px solid #fde68a;
    color: #92400e;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.summary-box strong {
    font-size: 1.1rem;
    font-weight: 800;
    color: #b45309;
}

/* --- Sub Tabs --- */
.sub-tab-navigation {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    background-color: #f1f5f9;
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.sub-tab-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    border-radius: calc(var(--radius-md) - 2px);
    cursor: pointer;
    transition: var(--transition);
}

.sub-tab-btn.active {
    background-color: white;
    color: var(--primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.sub-tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.sub-tab-pane.active {
    display: block;
}

/* --- Capture Tab --- */
.capture-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.capture-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.info-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-field label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-field input {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    outline: none;
}

.capture-table-container {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.capture-table th, .capture-table td {
    padding: 10px 12px;
}

.capture-table td {
    font-size: 0.8rem;
}

.capture-preview-area {
    width: 100%;
    height: 320px;
    background-color: #0f172a;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    cursor: pointer;
}

.capture-preview-area:hover {
    border-color: var(--primary);
    background-color: #1e293b;
}

.capture-preview-area img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.capture-placeholder {
    text-align: center;
    color: #94a3b8;
}

.capture-placeholder i {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.capture-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.capture-controls .btn {
    flex: 1;
    padding: 10px 16px;
    font-size: 0.9rem;
}

.auto-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* --- Switch Slide Toggle --- */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--secondary);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--secondary);
}

input:checked + .slider:before {
    transform: translateX(20px);
}
