:root {
    --primary: #0056b3;
    --primary-hover: #004494;
    --bg-light: #f4f7f6;
    --container-bg: #ffffff;
    --border-color: #dce1e6;
    --text-main: #2d3748;
    --text-muted: #718096;
    --error: #e53e3e;
    --success: #38a169;
    --radius-lg: 16px;
    --radius-md: 8px;
    --radius-sm: 6px;
    --transition: 0.2s ease-in-out;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    padding: 1rem;
}

/* Light Background */
.background-light {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background: linear-gradient(135deg, #f4f7f6 0%, #e2e8f0 100%);
}

/* Layout Core */
.hidden {
    display: none !important;
}

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

.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }

/* Light Containers */
.light-container {
    background: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Typography & Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: auto;
    max-width: 180px;
    height: 80px;
    margin-bottom: 1rem;
}

.logo-img {
    max-width: 100%;
    height: 100%;
    object-fit: contain;
}

.header-logo-small {
    height: 40px;
    width: 100px;
    display: flex;
    align-items: center;
}

.logo-img-small {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--text-main);
}

h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary);
}

h3 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Current Line Badge */
.current-line-badge {
    background: #ebf8ff;
    color: #2b6cb0;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    border: 1px solid #bee3f8;
}

/* Forms & Inputs */
.input-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
}

label {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

input[type="text"],
input[type="password"],
select {
    width: 100%;
    padding: 14px 16px;
    background: #ffffff;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
    appearance: none;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 86, 179, 0.1);
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23718096' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px;
    padding-right: 2.5rem;
    cursor: pointer;
}

select:disabled {
    background-color: #edf2f7;
    color: #a0aec0;
    cursor: not-allowed;
}

/* Buttons */
button {
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    width: 100%;
    padding: 16px;
    border-radius: var(--radius-md);
    background: var(--primary);
    color: white;
    font-size: 1.05rem;
    box-shadow: 0 4px 12px rgba(0, 86, 179, 0.2);
}

.btn-primary:not(:disabled):hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 86, 179, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: #cbd5e0;
    color: #ffffff;
    box-shadow: none;
    cursor: not-allowed;
}

.btn-secondary {
    width: 100%;
    padding: 16px;
    border-radius: var(--radius-md);
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    font-size: 1.05rem;
}

.btn-secondary:hover {
    background: #f0f7ff;
}

/* Camera button specifically robust for daylight */
.btn-camera {
    width: 100%;
    padding: 24px;
    border-radius: var(--radius-md);
    background: #ffffff;
    border: 2px dashed var(--primary);
    color: var(--primary);
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.btn-camera svg {
    width: 48px;
    height: 48px;
    color: var(--primary);
}

.btn-camera:hover {
    background: #f0f7ff;
    border-style: solid;
}

.btn-icon {
    background: transparent;
    color: var(--text-muted);
    padding: 8px;
    border-radius: var(--radius-sm);
}

.btn-icon:hover {
    color: var(--error);
    background: #fff5f5;
}

#image-preview {
    position: relative;
    width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid var(--border-color);
}

#preview-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    max-height: 250px;
    background: #edf2f7;
}

.absolute-top-right {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ffffff;
    color: var(--text-main);
    border-radius: 50%;
    padding: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.absolute-top-right:hover {
    background: var(--error);
    color: white;
}

/* User Info Bar */
.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e2e8f0;
    color: var(--primary);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1rem;
    border: 2px solid var(--primary);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    text-align: center;
    background: #ffffff;
    border: none;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.success-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #f0fff4;
    color: var(--success);
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 1.5rem;
    box-shadow: 0 4px 12px rgba(56, 161, 105, 0.15);
}

.filename-badge {
    background: #edf2f7;
    padding: 1rem;
    border-radius: var(--radius-sm);
    font-family: monospace;
    color: var(--text-main);
    word-break: break-all;
    margin-top: 1rem;
    border: 1px solid var(--border-color);
    font-weight: 600;
}

/* Upload Indicator */
#uploading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--primary);
    font-weight: 600;
    padding: 1rem;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(0, 86, 179, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Badge Offline */
.badge-warning {
    background-color: #feebc8;
    color: #c05621;
    text-align: center;
    padding: 10px;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-weight: 600;
    border: 1px solid #fbd38d;
}

/* Sync Panel */
.sync-panel {
    background: #e2e8f0;
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px dashed var(--text-muted);
    text-align: center;
}

.sync-panel p {
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-light);
}
::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}
