/* assets/css/style.css */

:root {
    --primary-color: #6366f1;
    /* Indigo 500 */
    --primary-hover: #4f46e5;
    --secondary-color: #ec4899;
    /* Pink 500 */
    --bg-color: #0f172a;
    /* Slate 900 */
    --surface-color: #1e293b;
    /* Slate 800 */
    --text-color: #f8fafc;
    /* Slate 50 */
    --text-muted: #94a3b8;
    /* Slate 400 */
    --success-color: #10b981;
    --error-color: #ef4444;
    --border-color: rgba(148, 163, 184, 0.1);
    --font-family: 'Inter', system-ui, sans-serif;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.2s;
}

ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Typography */
h1,
h2,
h3,
h4 {
    margin: 0 0 1rem 0;
    font-weight: 700;
}

h1 {
    font-size: 2rem;
}

h3 {
    font-size: 1.25rem;
}

/* Layout Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.items-center {
    align-items: center;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.w-full {
    width: 100%;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.p-4 {
    padding: 1rem;
}

.text-center {
    text-align: center;
}

.hidden {
    display: none !important;
}

/* Navbar */
.navbar {
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(8px);
}

.nav-link {
    color: var(--text-muted);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
}

.nav-link:hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.05);
}

/* Cards & Panels (Admin UI) */
.card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    box-sizing: border-box;
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-danger {
    background: var(--error-color);
    color: white;
}

/* Tables */
.table-container {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface-color);
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.badge-error {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* ------------------------------------------------------------------ */
/* SCREEN SPECIFIC: CAMERA / SCANNER                                  */
/* These styles apply when the body has class 'camera-mode' or specific pages */
/* ------------------------------------------------------------------ */

.camera-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    background: #000;
}

#scanner-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#scanner-container canvas {
    display: none;
}

/* Overlay UI for Scanner */
.overlay-ui {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: flex;
    flex-direction: column;
    pointer-events: none;
}

.overlay-ui .top-bar {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    pointer-events: auto;
}

.overlay-ui .brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.overlay-ui .scan-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scan-frame {
    width: 80%;
    max-width: 350px;
    height: 180px;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    position: relative;
    box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.5);
}

.scan-frame.active {
    border-color: #34d399;
    box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.5);
}

.laser-line {
    position: absolute;
    top: 50%;
    width: 100%;
    height: 2px;
    background: #ef4444;
    box-shadow: 0 0 8px #ef4444;
    animation: scan 2s infinite;
}

@keyframes scan {
    0% {
        transform: translateY(-80px);
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: translateY(80px);
        opacity: 0;
    }
}

.overlay-ui .bottom-bar {
    padding: 2rem;
    display: flex;
    justify-content: center;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    pointer-events: auto;
}

.capture-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: transparent;
    border: 4px solid white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.capture-btn::after {
    content: '';
    width: 66px;
    height: 66px;
    background: white;
    border-radius: 50%;
    transition: 0.2s;
}

.capture-btn:active::after {
    transform: scale(0.9);
}

.capture-btn.loading {
    border-top-color: var(--primary-color);
    animation: spin 1s infinite linear;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.hint-text {
    position: absolute;
    bottom: -30px;
    width: 100%;
    text-align: center;
    color: white;
    font-size: 0.9rem;
    text-shadow: 0 2px 4px black;
}

/* Result Drawer */
.result-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--surface-color);
    padding: 2rem;
    border-radius: 1.5rem 1.5rem 0 0;
    transform: translateY(110%);
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
    box-sizing: border-box;
    border-top: 1px solid var(--border-color);
}

.result-drawer.open {
    transform: translateY(0);
}

.drawer-handle {
    width: 50px;
    height: 4px;
    background: var(--text-muted);
    margin: 0 auto 1.5rem auto;
    border-radius: 2px;
    opacity: 0.5;
}

@media (min-width: 768px) {
    .result-drawer {
        width: 400px;
        left: 50%;
        margin-left: -200px;
        bottom: 2rem;
        border-radius: 1rem;
    }
}