:root {
    --bg-base: #0b0f19;
    --bg-surface: #151c2c;
    --bg-surface-hover: #1e293b;
    --border-color: #273549;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: rgba(59, 130, 246, 0.15);
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #10b981;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    overflow: hidden;
    height: 100vh;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar styling */
.sidebar {
    width: 320px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.brand {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.brand-info h1 {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.brand-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

.badge {
    background-color: var(--primary-light);
    color: var(--primary);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.sidebar-scroll::-webkit-scrollbar {
    width: 6px;
}
.sidebar-scroll::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
}

/* Control Groups */
.control-group {
    margin-top: 0;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.control-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.control-group h2 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.control-row {
    margin-top: 0;
    margin-bottom: 14px;
}

.control-row:last-child {
    margin-bottom: 0;
}

label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.label-with-val {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.label-with-val label {
    margin-bottom: 0;
}

.label-with-val span {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
}

/* Form Inputs */
select, input[type="number"], input[type="text"] {
    width: 100%;
    background-color: rgba(11, 15, 25, 0.5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    transition: var(--transition);
}

select:focus, input[type="number"]:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 48px;
    height: 32px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: none;
}

input[type="color"]::-webkit-color-swatch {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

/* Dimensions Row */
.dimensions-row {
    display: flex;
    gap: 12px;
}

.input-col {
    flex: 1;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background-color: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--bg-surface-hover);
}

.btn-danger {
    background-color: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background-color: var(--danger-hover);
}

.btn-block {
    width: 100%;
}

.reset-btn {
    width: 100%;
    font-size: 12px;
    padding: 8px;
    margin-top: 10px;
}

/* Main Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.top-bar {
    height: 64px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-muted);
}

.status-dot.pulsing {
    background-color: var(--primary);
    box-shadow: 0 0 8px var(--primary);
    animation: pulse 1.5s infinite alternate;
}

.status-dot.success {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

@keyframes pulse {
    0% { opacity: 0.4; }
    100% { opacity: 1; }
}

.github-link {
    font-size: 20px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.github-link:hover {
    color: var(--text-primary);
}

/* Dashboard Body */
.dashboard-body {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Dropzone */
.dropzone-card {
    background-color: var(--bg-surface);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 48px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.dropzone-card:hover, .dropzone-card.dragover {
    border-color: var(--primary);
    background-color: rgba(59, 130, 246, 0.04);
}

.icon-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin: 0 auto 16px auto;
}

.dropzone-card h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.dropzone-card p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 12px;
}

.file-limits {
    font-size: 12px;
    color: var(--text-muted);
}

/* Batch Header */
.batch-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 12px 18px;
    border-radius: var(--radius-md);
}

.batch-info {
    font-size: 14px;
    font-weight: 600;
}

.batch-actions-btn {
    display: flex;
    gap: 12px;
}

/* Images Grid */
.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.image-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.image-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.card-preview-wrapper {
    width: 100%;
    aspect-ratio: 1;
    background-color: rgba(0,0,0,0.1);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-preview-wrapper img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.card-badge {
    position: absolute;
    top: 10px;
    left: 38px;
    background-color: rgba(0, 0, 0, 0.75);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 10px;
}

.card-badge.detected {
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.card-badge.no-face {
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.card-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 6px;
}

.action-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: rgba(0,0,0,0.65);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: var(--transition);
}

.action-btn:hover {
    background-color: var(--primary);
}

.action-btn.delete-btn:hover {
    background-color: var(--danger);
}

.card-footer {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.image-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-size {
    font-size: 11px;
    color: var(--text-muted);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: var(--transition);
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(3, 7, 18, 0.85);
    backdrop-filter: blur(8px);
}

.modal-wrapper {
    position: relative;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 960px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

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

.modal-body {
    padding: 24px;
}

.preview-layout {
    display: flex;
    gap: 24px;
    height: 500px;
}

.editor-container {
    flex: 1;
    background-color: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#editor-canvas {
    max-width: 100%;
    max-height: 100%;
    display: block;
}

.crop-overlay {
    position: absolute;
    border: 2px dashed var(--primary);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
    pointer-events: none;
}

.result-sidebar {
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.result-preview-box {
    width: 200px;
    height: 200px;
    margin: 0 auto;
    background-color: rgba(0,0,0,0.15);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#result-canvas {
    max-width: 100%;
    max-height: 100%;
    display: block;
}

.preview-meta {
    background-color: rgba(11, 15, 25, 0.4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
}

.meta-item {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.meta-item .label {
    color: var(--text-secondary);
}

.meta-item .val {
    font-weight: 600;
}

.hidden {
    display: none !important;
}

/* Preset Colors & Toggle styling */
.preset-color-btn {
    transition: var(--transition);
}
.preset-color-btn:hover {
    transform: scale(1.1);
}
.preset-color-btn.active {
    box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px var(--primary) !important;
}
.toggle-container input[type="checkbox"] {
    accent-color: var(--primary);
    cursor: pointer;
}

.image-card.selected {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px var(--primary-light), 0 8px 24px rgba(0, 0, 0, 0.2) !important;
}

