/* Global Reset & CSS Variables */
:root {
    --bg-gradient: radial-gradient(circle at top left, #0f172a, #020617);
    --card-bg: rgba(30, 41, 59, 0.45);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --accent-color: #6366f1; /* Indigo */
    --accent-hover: #4f46e5;
    --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --success-color: #10b981;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-display: 'Outfit', sans-serif;
}

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

body {
    background: var(--bg-gradient);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
    line-height: 1.5;
}

/* App Container */
.app-container {
    width: 100%;
    max-width: 1400px;
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 1rem;
}

.logo-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo-icon-svg {
    color: var(--accent-color);
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.6));
}

.app-header h1 {
    font-family: var(--font-display);
    font-size: 2.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(to right, #ffffff, #c7d2fe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.125rem;
    font-weight: 400;
}

/* Layout Grid */
.app-main {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .app-main {
        grid-template-columns: 1fr;
    }
}

/* Sidebar & Workspace Sections */
.sidebar-section, .workspace-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Cards (Glassmorphism) */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.step-badge {
    background: var(--accent-gradient);
    color: #ffffff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.card h2 {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
    line-height: 1.4;
}

/* Drag & Drop Zone */
.dropzone {
    border: 2px dashed rgba(99, 102, 241, 0.25);
    border-radius: var(--radius-md);
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(15, 23, 42, 0.2);
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--accent-color);
    background: rgba(99, 102, 241, 0.05);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.1);
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-icon-svg {
    color: var(--text-muted);
    display: block;
    margin: 0 auto 0.75rem auto;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
    transition: transform 0.2s ease, color 0.2s ease;
}

.dropzone:hover .upload-icon-svg {
    transform: translateY(-4px);
    color: var(--accent-color);
}

.dropzone-prompt p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.dropzone-prompt strong {
    color: var(--accent-color);
}

.sub-prompt {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Watermark Preview Container */
.watermark-preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
}

.watermark-preview-container img {
    max-height: 110px;
    max-width: 100%;
    object-fit: contain;
    border-radius: var(--radius-sm);
    background: repeating-conic-gradient(#1e293b 0% 25%, #0f172a 0% 50%) 50% / 20px 20px;
    padding: 8px;
    border: 1px solid var(--card-border);
}

/* Controls */
.control-group {
    margin-bottom: 1.5rem;
}

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

.control-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.control-label label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.control-value {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent-color);
}

.help-text {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

/* Premium Sliders */
.slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    transition: background 0.3s;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-gradient);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
    transition: transform 0.1s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: var(--accent-gradient);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
    transition: transform 0.1s ease;
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.2);
}

/* Preview Section Header */
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 1.25rem;
}

.action-buttons {
    display: flex;
    gap: 0.75rem;
}

/* Buttons */
.btn {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-primary {
    background: var(--accent-gradient);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

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

/* Preview Grid */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}

.preview-item {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.preview-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    border-color: rgba(99, 102, 241, 0.3);
}

.preview-img-wrapper {
    position: relative;
    aspect-ratio: 4/3;
    background: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: zoom-in;
    transition: background-color 0.2s ease;
}

.preview-img-wrapper:hover {
    background-color: rgba(99, 102, 241, 0.05);
}

.preview-img-wrapper img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.preview-img-wrapper:hover img {
    transform: scale(1.02);
}

.preview-info {
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.preview-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-actions {
    display: flex;
    gap: 0.5rem;
}

.preview-actions .btn {
    flex: 1;
}

/* Floating Remove Button */
.btn-remove-item {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-secondary);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    z-index: 2;
}

.btn-remove-item:hover {
    background: var(--danger-color);
    color: white;
    transform: scale(1.1);
}

/* Footer Styling */
.app-footer {
    text-align: center;
    padding: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--card-border);
    margin-top: 2rem;
}

.app-footer a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.app-footer a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Modal Overlay styling */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
    cursor: zoom-out;
}

.modal-content {
    max-width: 90%;
    max-height: 80%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    pointer-events: auto;
    cursor: default;
}

.modal-content img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    border: 1px solid var(--card-border);
}

#modal-caption {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
}

.modal-close {
    position: absolute;
    top: 24px;
    right: 32px;
    font-size: 3rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease, transform 0.2s ease;
    user-select: none;
}

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

/* Slider with buttons */
.slider-with-buttons {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.btn-adjust {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    user-select: none;
}

.btn-adjust:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
}

.btn-adjust:active {
    transform: scale(0.92);
}
