:root {
    /* Premium Trust Palette */
    --primary-color: #2563eb;
    /* Royal Blue - Trust & Authority */
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    /* Slate - Professionalism */
    --accent-color: #3b82f6;
    --success-color: #10b981;
    /* Emerald - Crisp Success */
    --danger-color: #ef4444;
    /* Red - Clear Warning */
    --background-bg: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.95);
    /* Glassy Opaque */
    --text-main: #0f172a;
    /* Slate 900 - Sharp Contrast */
    --text-muted: #64748b;
    --border-radius: 18px;
    /* App-like Modern Radius */
    --shadow-soft: 0 10px 30px -5px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.2);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: #f8fafc;
    /* Clean solid background */
    color: var(--text-main);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "cv11", "ss01";
    /* Modern font features */
}

.main-container {
    width: 100%;
    max-width: 800px;
    /* Wider for better desktop view, still app-like */
    margin: 0 auto;
}

/* Header Areas */
header {
    text-align: center;
    margin-bottom: 2rem;
    animation: fadeInDown 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.header-top {
    display: flex;
    justify-content: space-between;
    /* Standard Startup: Logo Left, Actions Right */
    align-items: center;
    margin-bottom: 3rem;
    /* More breathing room */
    padding: 20px 0;
    /* Vertical spacing */
    position: relative;
    min-height: 60px;
}

.logo {
    display: flex;
    align-items: center;
    /* Dynamic scaling: never smaller than 40px, grows with screen, caps at 64px */
    height: clamp(40px, 8vw, 64px);
    width: auto;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.logo:hover {
    opacity: 1;
}

.logo img {
    height: 100%;
    width: auto;
    object-fit: contain;
    /* Ensure aspect ratio stays perfect */
    mix-blend-mode: multiply;
    filter: contrast(1.05);
}

/* Login button in Navbar */
#loginBtn {
    /* Startup Style: Subtle Ghost Button */
    background: transparent;
    padding: 10px;
    border-radius: 50%;
    /* Circle */
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: static;
    /* Flow naturally */
    transform: none;
    margin: 0;
    border: 1px solid rgba(0, 0, 0, 0.05);
    /* Very subtle border */
}

#loginBtn:hover {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

h1,
h2,
h3 {
    letter-spacing: -0.03em;
    color: var(--text-main);
}

h1 {
    font-size: 2.5rem;
    /* Slightly larger for impact */
    font-weight: 800;
    margin-bottom: 12px;
    background: -webkit-linear-gradient(45deg, #0f172a, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1.6;
    max-width: 90%;
    margin: 0 auto;
}

button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 14px 25px;
    /* Slightly tighter horizontal */
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    /* Bolder text */
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    /* Stronger shadow */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.4);
}

/* Subtle Pulse Animation for Primary CTA */
#checkBtn {
    animation: pulse-glow 3s infinite;
}

@keyframes pulse-glow {
    0% {
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    }

    50% {
        box-shadow: 0 4px 20px rgba(37, 99, 235, 0.6);
    }

    100% {
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    }
}

main button:active {
    transform: scale(0.98);
    /* Tactile feedback */
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    /* Make text gray/subtle */
    padding: 10px 15px;
    font-size: 0.95rem;
    height: auto;
    border: none;
    /* Remove border completely */
    font-weight: 500;

}

.btn-ghost:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--primary-color);
    box-shadow: none;
    transform: none;
}

.btn-ghost.small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-danger {
    background: var(--accent-color);
    width: 100%;
    margin-top: 15px;
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 10px 25px rgba(239, 68, 68, 0.3);
}

.btn-full {
    width: 100%;
}

/* Clean Minimal Cards */
.card,
.search-card {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 40px;
    /* More whitespace */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    /* Very subtle shadow */
    margin-bottom: 20px;
    border: none;
    /* No border for cleaner look */
    transition: transform 0.3s ease;
}

.search-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

/* Modern Inputs */
input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 0 16px;
    /* Horizontal padding only, height handled by height prop */
    height: 50px;
    /* Explicit match with button */
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s;
    background: #fff;
    color: var(--text-main);
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
    /* Crucial for height calc */
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    /* Soft focus ring */
    outline: none;
    background-color: #fff;
}

input.error {
    border-color: var(--accent-color);
    background-color: #fef2f2;
}

.error-msg {
    color: var(--accent-color);
    font-size: 0.85rem;
    margin-top: 8px;
    display: none;
    font-weight: 500;
}

.input-group {
    display: flex;
    gap: 10px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
}

/* Result Visualization */
.result-container {
    background: var(--card-bg);
    padding: 35px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    text-align: center;
    border: 1px solid #f3f4f6;
}

/* Modals with nice backdrop */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(17, 24, 39, 0.4);
    /* Darker, cleaner overlay */
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background: white;
    padding: 45px;
    border-radius: var(--radius);
    width: 90%;
    max-width: 440px;
    position: relative;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.95);
    animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 2rem;
    cursor: pointer;
    color: #9ca3af;
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--text-main);
}

/* File Upload - Dotted Area */
.file-upload-container {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.file-input-wrapper {
    flex: 1;
    min-width: 140px;
}

.file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border: 2px dashed #e5e7eb;
    border-radius: 14px;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    color: var(--text-muted);
    font-weight: 500;
}

.file-label:hover {
    border-color: var(--primary-color);
    background: #fff;
    color: var(--primary-color);
}

.file-label .icon {
    font-size: 1.8rem;
    margin-bottom: 8px;
    color: #9ca3af;
}

.file-label:hover .icon {
    color: var(--primary-color);
}

/* Mobile Friendly Scan Button */
.scan-btn {
    display: none;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #6b7280;
    padding: 8px;
    cursor: pointer;
}

.serial-input-field {
    padding-right: 20px;
}

@media (max-width: 768px) {
    .scan-btn {
        display: block;
    }

    .serial-input-field {
        padding-right: 50px;
    }
}

/* Toasts */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #1f2937;
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10000;
    font-weight: 500;
}

.toast.visible {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--secondary-color);
}

.toast.error {
    background: var(--accent-color);
}

.toast.info {
    background: #1f2937;
}



/* Autocomplete Dropdown */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 14px 14px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    display: none;
}

.autocomplete-results.visible {
    display: block;
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f3f4f6;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: #f9fafb;
}

.autocomplete-item strong {
    display: block;
    color: var(--text-main);
    margin-bottom: 2px;
}

.autocomplete-item .secondary-text {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* File Upload Status */
.file-status {
    display: block;
    font-size: 0.8rem;
    margin-top: 5px;
    color: var(--text-muted);
}

.file-label.has-file {
    border-color: var(--secondary-color);
    background: #f0fdf4;
}

.file-label.has-file .file-status {
    color: var(--secondary-color);
    font-weight: 600;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 20px 0;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin-top: 3px;
    cursor: pointer;
}

.checkbox-group label {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.5;
    cursor: pointer;
}

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

.checkbox-group a:hover {
    text-decoration: underline;
}

/* Text Utilities */
.text-small {
    font-size: 0.85rem;
}

.text-muted {
    color: var(--text-muted);
}

.subtitle {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Status Indicators */
.status-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.status-ok {
    border-left: 5px solid var(--secondary-color);
}

.status-stolen {
    border-left: 5px solid var(--accent-color);
}

.status-unknown {
    border-left: 5px solid #95a5a6;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 50px;
    padding-bottom: 30px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

footer a {
    color: var(--text-muted);
    transition: color 0.2s;
    display: inline-block;
    padding: 5px;
}

footer a:hover {
    color: var(--primary-color);
}

/* Utilities & Animations */
.hidden {
    display: none !important;
}

/* Focus Mode (Cinema Effect) */
body.focus-mode .features-grid,
body.focus-mode .card:not(.search-card) {
    opacity: 0.2;
    filter: grayscale(100%) blur(1px);
    transition: all 0.5s ease;
    pointer-events: none;
    /* Optional: prevent clicks on dimmed elements */
}

/* Ensure Result is above everything */
.result-container {
    transition: all 0.3s ease;
    /* ... existing styles ... */
    position: relative;
    z-index: 10;
}


@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes popInCheck {
    0% {
        transform: scale(0) rotate(-45deg);
        opacity: 0;
    }

    70% {
        transform: scale(1.2) rotate(10deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.status-icon.animate-pop {
    animation: popInCheck 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
    to {
        transform: scale(1);
    }
}

@media (max-width: 768px) {
    body {
        padding: 15px;
    }

    .main-container {
        width: 100%;
    }

    h1 {
        font-size: 1.8rem;
    }

    header p {
        font-size: 1rem;
    }

    .logo {
        height: 40px !important;
        /* Force smaller height */
    }

    .logo img {
        height: 100% !important;
        width: auto !important;
        max-width: 140px;
    }

    /* Compact Search Card */
    .search-card {
        padding: 25px 20px;
    }

    .feature-item h3 {
        font-size: 0.85rem !important;
    }

    .feature-item p {
        font-size: 0.75rem !important;
        line-height: 1.2;
    }

    .input-group {
        /* Keep native row layout or force it if needed, removing column force */
        gap: 8px;
        /* Slightly smaller gap than desktop */
    }

    button {
        width: auto;
        /* Let it shrink to content */
        padding: 14px 20px;
        /* Compact padding */
    }

    /* Mobile Modal Fixes */
    .modal-content {
        padding: 25px;
        width: 95%;
    }

    /* Stack features in report view */
    #reportView .features-grid {
        display: flex !important;
        flex-direction: row;
        overflow-x: auto;
        gap: 15px;
        padding-bottom: 5px;
        /* Scrollbar space */
    }

    #reportView .feature-item {
        min-width: 90px;
        flex-shrink: 0;
    }

    .file-upload-container {
        flex-direction: column;
    }
}