:root {
    /* Black & White Manga Aesthetic */
    --primary: #2b2b2b;
    --primary-hover: #000000;
    --secondary: #e5e5e5;
    --secondary-hover: #cccccc;
    --bg-color: #f7f7f7;
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-main: #1a1a1a;
    --text-light: #666666;
    
    /* Status colors converted to grayscale or stark accents */
    --success: #333333; /* Dark gray */
    --warning: #777777; /* Medium gray */
    --error: #555555;   /* Dark gray */
    --active: #444444;
    
    --border: #d1d1d1;
    --shadow: rgba(0, 0, 0, 0.15);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    font-family: 'Kanit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    z-index: 1;
}

/* Background Image Overlay (faint) */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('1767098396976-d6ecc51e3d3a9989.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.15; /* สีจางๆ ตาม request */
    z-index: -1;
    pointer-events: none;
}

/* Base Styles */
h1, h2, h3 { color: var(--primary-hover); margin-bottom: 0.5rem; letter-spacing: -0.5px; }
.subtitle { color: var(--text-light); margin-top: 0; margin-bottom: 1.5rem; font-size: 0.95rem; }
.hidden { display: none !important; }

/* Buttons */
.btn {
    border: 1px solid var(--primary);
    border-radius: 6px; /* Sharper edges for manga feel */
    padding: 10px 20px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.primary-btn {
    background: var(--primary);
    color: white;
    box-shadow: 4px 4px 0px rgba(0,0,0,0.8); /* Comic-book style hard shadow */
}
.primary-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px rgba(0,0,0,1);
}
.primary-btn:active:not(:disabled) {
    transform: translate(2px, 2px);
    box-shadow: 0px 0px 0px rgba(0,0,0,1);
}
.secondary-btn {
    background-color: white;
    color: var(--primary-hover);
    border: 2px solid var(--primary-hover);
}
.secondary-btn:hover { background-color: var(--secondary); }
.btn-lg { width: 100%; padding: 14px; font-size: 1.1rem; margin-top: 1rem;}
.small { padding: 6px 12px; font-size: 0.85rem; border-radius: 4px; border-width: 1px;}
.full-width { width: 100%; }

/* Layout & Views */
.view {
    display: none;
    min-height: 100vh;
    padding: 2rem;
}
.view.active { display: flex; flex-direction: column; align-items: center;}

/* Card Styles */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 8px 8px 0px rgba(0, 0, 0, 0.05);
    border: 2px solid var(--primary);
    margin-bottom: 2rem;
    width: 100%;
    position: relative;
    overflow: hidden;
}

/* Screentone subtle pattern for cards */
.card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: radial-gradient(var(--border) 1px, transparent 1px);
    background-size: 10px 10px;
    opacity: 0.3;
    z-index: 0;
    pointer-events: none;
}
.card > * { position: relative; z-index: 1; }

.login-card { max-width: 400px; text-align: center; margin: auto; }
.dashboard-content { width: 100%; max-width: 1000px; margin: 0 auto; display: grid; grid-template-columns: 1fr; gap: 2rem;}

@media (min-width: 900px) {
    .dashboard-content { grid-template-columns: 350px 1fr; }
}

/* Form Styles */
.form-group { margin-bottom: 1.2rem; text-align: left; }
label { display: block; margin-bottom: 0.5rem; font-weight: 600; font-size: 0.95rem; }
input:not([type="file"]) {
    width: 100%;
    padding: 12px 15px;
    border-radius: 6px;
    border: 2px solid var(--primary);
    outline: none;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fafafa;
}
input:not([type="file"]):focus { border-color: var(--primary-hover); box-shadow: 4px 4px 0px var(--secondary); background: white; }
.error-msg { color: var(--error); font-size: 0.9rem; margin-top: 1rem; min-height: 1.2rem; font-weight: 600; }

/* Dashboard Header */
.glass-header {
    width: 100%; max-width: 1000px; margin: 0 auto 2rem;
    background: var(--card-bg);
    border-radius: 12px; padding: 1rem 2rem;
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: 4px 4px 0px rgba(0,0,0,0.05); border: 2px solid var(--primary);
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-left h2 { margin: 0; font-size: 1.5rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;}
.header-right { display: flex; align-items: center; gap: 15px; }
.user-badge { background: var(--secondary); padding: 6px 15px; border-radius: 6px; font-weight: 600; color: var(--primary-hover); border: 1px solid var(--primary); }

/* Upload Area */
.file-drop-area {
    border: 3px dashed var(--primary); border-radius: 12px;
    padding: 3rem 1rem; text-align: center; background: rgba(255, 255, 255, 0.8);
    position: relative; transition: all 0.3s ease; margin-bottom: 1rem;
    cursor: pointer;
}
.file-drop-area:hover, .file-drop-area.dragover { background: var(--secondary); border-style: solid; box-shadow: inset 0 0 10px rgba(0,0,0,0.1); }
.file-drop-area input[type="file"] {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0; cursor: pointer;
}
.drop-icon { font-size: 2.5rem; display: block; margin-bottom: 10px; filter: grayscale(100%); }
.drop-text { color: var(--primary-hover); font-weight: 600; }
.file-name { margin-bottom: 1rem; color: var(--text-main); font-weight: 700; text-align: center; background: var(--secondary); padding: 8px; border-radius: 6px; border: 1px solid var(--primary);}

/* Progress bar */
.progress-wrapper { background: white; padding: 1rem; border-radius: 8px; border: 2px solid var(--primary); }
.progress-info { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.9rem; font-weight: 600;}
.progress-bar-bg { width: 100%; height: 12px; background: var(--border); border-radius: 2px; overflow: hidden; position: relative; border: 1px solid var(--primary); }
.progress-fill { height: 100%; width: 0%; border-radius: 0; transition: width 0.3s ease; }

/* B&W stripe effect for progress */
.upload-fill { background: repeating-linear-gradient(45deg, var(--text-light), var(--text-light) 10px, var(--primary) 10px, var(--primary) 20px); }
.work-fill { background: var(--text-main); }
.complete-fill { background: var(--primary-hover); }

/* Queue Dashboard */
.queue-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 2px dashed var(--border); }
.worker-badge { background: white; border: 2px solid var(--primary); padding: 6px 15px; border-radius: 6px; font-size: 0.9rem; display: flex; align-items: center; gap: 8px; font-weight: 600; box-shadow: 2px 2px 0px rgba(0,0,0,0.1); }
.pulse-dot { display: block; width: 10px; height: 10px; background: var(--text-main); border-radius: 50%; animation: pulse 2s infinite; }

.queue-panels { display: flex; flex-direction: column; gap: 1.5rem; }
.section-title { font-weight: 700; margin-bottom: 10px; font-size: 1.1rem; text-transform: uppercase; border-left: 4px solid var(--primary); padding-left: 10px; }
.text-active { color: var(--text-main); }
.text-waiting { color: var(--text-light); }
.text-success { color: var(--primary-hover); }

.job-list { background: rgba(0, 0, 0, 0.02); border-radius: 8px; padding: 1rem; min-height: 80px; border: 1px solid var(--border); }
.empty-state { text-align: center; color: var(--text-light); font-size: 0.95rem; padding: 1rem 0; font-style: italic; font-weight: 500; }

.job-item { background: white; border-radius: 6px; padding: 1rem; margin-bottom: 10px; border: 2px solid var(--primary); box-shadow: 3px 3px 0px rgba(0,0,0,0.05); }
.job-item:last-child { margin-bottom: 0; }
.job-info { display: flex; justify-content: space-between; margin-bottom: 8px; align-items: center; }
.job-file { font-weight: 700; word-break: break-all; font-size: 0.95rem; letter-spacing: 0.5px;}
.job-eta { font-size: 0.85rem; color: var(--text-main); background: var(--secondary); padding: 2px 8px; border-radius: 4px; border: 1px solid var(--border); font-weight: 500;}
.job-progress-info { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 6px; color: var(--text-main); font-weight: 600;}

.dl-btn { background: var(--primary) !important; color: white !important; font-size: 0.85rem; padding: 6px 15px; border-radius: 4px; text-decoration: none; display: inline-block; box-shadow: 2px 2px 0px rgba(0,0,0,0.3); font-weight: 600; border: 1px solid var(--primary-hover); text-transform: uppercase; }
.dl-btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0px rgba(0,0,0,0.5); }
.dl-btn:active { transform: translate(1px, 1px); box-shadow: 0px 0px 0px rgba(0,0,0,0.5); }

/* Animations */
@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}
.fade-in { animation: fadeIn 0.5s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Queue Modal Styles */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); display: flex; justify-content: center; align-items: center;
    z-index: 1000; backdrop-filter: blur(5px);
}
.modal-overlay.hidden { display: none !important; }
.modal-card {
    background: white; width: 90%; max-width: 500px; border-radius: 12px;
    padding: 2rem; max-height: 80vh; overflow-y: auto; position: relative;
    box-shadow: 10px 10px 0px rgba(0,0,0,1);
    border: 4px solid var(--primary-hover);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; border-bottom: 3px solid var(--primary); padding-bottom: 10px; }
.close-btn { background: none; border: none; font-size: 2rem; cursor: pointer; color: var(--text-main); font-weight: bold; line-height: 1; }
.close-btn:hover { color: var(--primary-hover); transform: scale(1.1); }
.job-title { font-weight: 700; font-size: 1rem; color: var(--primary-hover); word-break: break-all; }
.job-meta { font-size: 0.9rem; color: var(--text-light); margin-top: 4px; font-weight: 500; }
