:root {
    --bg-color: #0a0a0a;
    --surface-color: #1a1a1a;
    --primary-color: #2196F3;
    --secondary-color: #4CAF50;
    --text-color: #ffffff;
    --text-secondary: #999999;
    --border-color: #333333;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.login-box {
    background: var(--surface-color);
    padding: 3rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.login-box h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #2196F3, #4CAF50);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.btn-login {
    display: inline-block;
    margin-top: 1.5rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
}

/* Config Bar */
.config-bar {
    padding: 1.5rem;
    background: var(--surface-color);
    display: flex;
    gap: 1rem;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.input-field {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #0a0a0a;
    color: white;
    flex: 1;
    font-size: 0.95rem;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

.btn-primary {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #2196F3, #1976D2);
    border: none;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.5);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #4CAF50, #388E3C);
    border: none;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-secondary:hover {
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.5);
    transform: translateY(-1px);
}

/* Main Content - FIXED */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* Viewer Section (80%) - FIXED */
.viewer-section {
    flex: 0 0 80%;
    min-width: 0;
    max-width: 80%;
    background: #000;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    border-right: 1px solid var(--border-color);
    overflow: hidden;
}

.top-right {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 10;
}

.print-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.8);
    padding: 0.75rem;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.btn-icon {
    width: 50px;
    height: 50px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
    color: white;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.8rem;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: linear-gradient(135deg, #2a2a2a, #3a3a3a);
    transform: scale(1.05);
}

.btn-icon:active {
    transform: scale(0.95);
}

.qty-input {
    width: 70px;
    height: 50px;
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: white;
    font-size: 1.6rem;
    font-weight: bold;
}

.qty-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-print {
    height: 50px;
    padding: 0 2.5rem;
    background: linear-gradient(135deg, #2196F3, #1976D2);
    border: none;
    color: white;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-print:hover {
    box-shadow: 0 6px 16px rgba(33, 150, 243, 0.6);
    transform: translateY(-2px);
}

.btn-print:active {
    transform: translateY(0);
}

.image-display {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

#mainImage {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
}

.placeholder {
    color: var(--text-secondary);
    font-size: 1.2rem;
}

/* Nav Arrow - FIXED */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 1rem;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.nav-arrow .material-icons {
    font-size: 3rem;
}

.nav-arrow:hover {
    background: rgba(33, 150, 243, 0.4);
    border-color: var(--primary-color);
}

.nav-arrow.left {
    left: 2rem;
}

.nav-arrow.right {
    right: 2rem;
}

/* Sidebar Section (20%) - FIXED */
.sidebar-section {
    flex: 0 0 20%;
    min-width: 0;
    max-width: 20%;
    display: flex;
    flex-direction: column;
    background: var(--surface-color);
    overflow: hidden;
}

.file-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
}

.file-list::-webkit-scrollbar {
    width: 8px;
}

.file-list::-webkit-scrollbar-track {
    background: #0a0a0a;
}

.file-list::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    background: #0a0a0a;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    min-width: 0;
}

.file-item:hover {
    background: #252525;
    border-color: rgba(33, 150, 243, 0.3);
}

.file-item.active {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.2), rgba(33, 150, 243, 0.1));
    border-color: var(--primary-color);
}

.file-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

/* File name - FIXED ELLIPSIS */
.file-name {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.qr-section {
    padding: 1.5rem;
    background: #0a0a0a;
    border-top: 1px solid var(--border-color);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.qr-section h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--primary-color);
}

#qrCodeContainer {
    margin: 1rem 0;
    background: white;
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

#qrStatus {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}