/* Palette: Modern Purple + Clean White */
:root {
    --ir-bg-gradient: linear-gradient(135deg, #f5f3ff 0%, #ffffff 100%);
    --ir-primary: #7c3aed;       /* Violet 600 */
    --ir-primary-hover: #6d28d9; /* Violet 700 */
    --ir-surface: #ffffff;
    --ir-text-main: #1e293b;     /* Slate 800 */
    --ir-text-muted: #64748b;    /* Slate 500 */
    --ir-border: #e2e8f0;        /* Slate 200 */
    --ir-radius: 16px;
    --ir-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --ir-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --ir-max-width: 1024px;
    --transition-speed: 0.3s;
}

[data-ir-theme="dark"] {
    --ir-bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    --ir-surface: #1e293b;
    --ir-text-main: #f8fafc;
    --ir-text-muted: #94a3b8;
    --ir-border: #334155;
    --ir-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
}

/* --- Base Layout --- */
body.ir-body {
    background: var(--ir-bg-gradient);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--ir-text-main);
    min-height: 100vh;
    margin: 0;
}

.ir-wrap {
    max-width: var(--ir-max-width);
    margin: 0 auto;
    padding-bottom: 60px;
}

/* --- Header --- */
.ir-header {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeInDown 0.6s ease;
}
.ir-title {
    font-size: 2.25rem;
    font-weight: 800;
    background: -webkit-linear-gradient(45deg, var(--ir-primary), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}
.ir-sub {
    color: var(--ir-text-muted);
    margin-top: 8px;
    font-size: 1.1rem;
}

/* --- Step 1: The Hero Dropzone --- */
.ir-drop-area {
    background: var(--ir-surface);
    border: 2px dashed var(--ir-primary);
    border-radius: var(--ir-radius);
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    position: relative;
    overflow: hidden;
    box-shadow: var(--ir-shadow-lg);
}
.ir-drop-area:hover, .ir-drop-area.ir-drag-active {
    background: #f5f3ff; /* light violet tint */
    transform: translateY(-2px);
    border-color: var(--ir-primary-hover);
}
[data-ir-theme="dark"] .ir-drop-area:hover { background: #1e1b4b; }

.ir-drop-icon {
    font-size: 4rem;
    color: var(--ir-primary);
    margin-bottom: 16px;
    display: inline-block;
}
.ir-drop-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}
.ir-drop-desc {
    color: var(--ir-text-muted);
    margin-bottom: 24px;
}
.ir-btn-hero {
    background: var(--ir-primary);
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 99px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
    transition: transform 0.2s;
}
.ir-btn-hero:hover { transform: scale(1.05); }

/* --- Step 2: Workspace (Hidden initially) --- */
#ir-workspace {
    display: none; /* Hidden by default per requirement */
    margin-top: 30px;
    animation: slideUp 0.5s ease;
}

/* Settings Toolbar */
.ir-toolbar {
    background: var(--ir-surface);
    border-radius: var(--ir-radius);
    padding: 20px;
    box-shadow: var(--ir-shadow-sm);
    border: 1px solid var(--ir-border);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    align-items: start;
    margin-bottom: 24px;
}

.ir-control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ir-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ir-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ir-input, .ir-select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--ir-border);
    background: var(--ir-surface);
    color: var(--ir-text-main);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}
.ir-input:focus, .ir-select:focus {
    border-color: var(--ir-primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}
.ir-input.error, .ir-select.error {
    border-color: #ef4444;
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

/* Dynamic Parameters Area */
.ir-params-panel {
    grid-column: 1 / -1;
    background: rgba(124, 58, 237, 0.04);
    padding: 16px;
    border-radius: 8px;
    border: 1px dashed var(--ir-primary);
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
}

/* Action Bar (Process / Clear) */
.ir-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px 0;
}
.ir-btn-primary {
    background: var(--ir-primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}
.ir-btn-primary:disabled {
    background: var(--ir-text-muted);
    cursor: not-allowed;
    opacity: 0.7;
}
.ir-btn-primary:not(:disabled):hover { background: var(--ir-primary-hover); }

.ir-btn-ghost {
    background: transparent;
    color: #ef4444;
    border: 1px solid #fee2e2;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
}
.ir-btn-ghost:hover { background: #fef2f2; }

.ir-btn-download-all {
    background: #10b981; /* Emerald 500 */
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.ir-btn-download-all:hover { background: #059669; }
.ir-btn-download-all:disabled { background: var(--ir-text-muted); opacity: 0.5; cursor: not-allowed; }


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

.ir-card {
    background: var(--ir-surface);
    border: 1px solid var(--ir-border);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}
.ir-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--ir-shadow-lg);
}

.ir-thumb-wrapper {
    height: 160px;
    background: #f1f5f9; /* checkered pattern bg ideally */
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}
.ir-thumb {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.ir-meta {
    margin-bottom: 12px;
}
.ir-filename {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--ir-text-main);
}
.ir-filesize {
    font-size: 0.8rem;
    color: var(--ir-text-muted);
}

.ir-card-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}
.ir-btn-sm {
    flex: 1;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid var(--ir-border);
    background: transparent;
    color: var(--ir-text-main);
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
}
.ir-btn-sm:hover { background: #f8fafc; }
.ir-btn-sm.delete:hover { color: #ef4444; border-color: #fecaca; background: #fef2f2; }
.ir-btn-sm.download { color: #10b981; border-color: #a7f3d0; background: #ecfdf5; }

/* Overlay for Removing */
.ir-remove-btn-abs {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    border: none;
    color: #ef4444;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Status Badge */
.ir-status {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 99px;
    background: #f1f5f9;
    color: var(--ir-text-muted);
    display: inline-block;
}
.ir-status.success { background: #d1fae5; color: #065f46; }


/* --- Info / Footer --- */
.ir-info-section {
    margin-top: 60px;
    padding-top: 20px;
    border-top: 1px solid var(--ir-border);
}
.ir-tips {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    font-size: 0.9rem;
    color: var(--ir-text-muted);
}
[data-ir-theme="dark"] .ir-tips { background: rgba(255,255,255,0.05); }
.ir-tips h4 { margin-top: 0; color: var(--ir-text-main); }
.ir-tips ul { padding-left: 20px; margin-bottom: 0; }
.ir-tips li { margin-bottom: 6px; }

/* Animations */
@keyframes fadeInDown { from { opacity:0; transform:translateY(-20px); } to { opacity:1; transform:translateY(0); } }
@keyframes slideUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }
@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Mobile Tweak */
@media (max-width: 768px) {
    .ir-toolbar { grid-template-columns: 1fr; }
    .ir-actions-bar { flex-direction: column; gap: 12px; align-items: stretch; }
    .ir-btn-primary, .ir-btn-download-all, .ir-btn-ghost { width: 100%; justify-content: center; }
}