:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg: #0a0a0a;
    --surface: #1a1a1a;
    --surface-elevated: #242424;
    --text: #f5f5f5;
    --text-muted: #a3a3a3;
    --border: #2a2a2a;
    --success: #22c55e;
    --danger: #ef4444;
    --radius: 12px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo{
    max-height: 50px;
}

.app-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
}

a{
    color: var(--text);
    text-decoration: none;
}
a:hover{
    text-decoration: underline;
}

.app-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

.app-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text);
    text-align: center;
}

.app-tagline {
    font-size: 0.95rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 2rem;
    font-weight: 400;
}

/* Footer */
.app-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.footer-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.6;
    font-weight: 400;
}

.footer-attribution {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.75rem;
    opacity: 0.7;
    font-weight: 400;
}

/* Format Tip */
.format-tip {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(99, 102, 241, 0.05));
    border-left: 3px solid var(--primary);
    padding: 0.875rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
    transition: all 0.3s ease;
    display: none;
}

.format-tip.active {
    display: block;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Main Layout - Two Column */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

/* Preview Section (Left) */
.preview-section {
    background-color: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border);
    position: sticky;
    top: 20px;
}

.preview-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

/* Background Patterns */
.preview-container.bg-checkered {
    background-color: #e5e5e5;
    background-image: 
        linear-gradient(45deg, #d4d4d4 25%, transparent 25%), 
        linear-gradient(-45deg, #d4d4d4 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #d4d4d4 75%), 
        linear-gradient(-45deg, transparent 75%, #d4d4d4 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.preview-container.bg-red {
    background-color: #dc2626;
}

.preview-container.bg-gradient {
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.preview-placeholder {
    text-align: center;
    color: var(--text-muted);
    text-shadow: 0 0px 15px rgba(0, 0, 0, 0.7);
}

.preview-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.preview-text {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.preview-subtext {
    font-size: 0.9rem;
}

.preview-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
}

.preview-canvas.active {
    display: block;
}

.preview-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    padding: 0.75rem;
    background-color: var(--bg);
    border-radius: 6px;
    margin-bottom: 1rem;
}

/* Background Control */
.background-control {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.background-control label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.background-control select {
    background-color: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
    width: 100%;
    font-family: inherit;
}

.background-control select:focus,
.background-control select:hover {
    border-color: var(--primary);
}

/* Progress Overlay on Preview */
.progress-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    z-index: 10;
}

.progress-overlay.active {
    display: flex;
}

.progress-overlay .progress-bar-bg {
    width: 80%;
    background-color: var(--surface);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-overlay .progress-text {
    color: var(--text);
    font-weight: 600;
}

/* Controls Section (Right) */
.controls-section {
    background-color: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border);
}

/* Dropzone */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.02);
    margin-bottom: 1.5rem;
    height: 150px;
}

.dropzone:hover,
.dropzone.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
    transform: translateY(-2px);
}

.dropzone-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    display: block;
}

.dropzone-text {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.dropzone-subtext {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* File List */
.file-list {
    margin-bottom: 1.5rem;
    height: 150px;
    overflow-y: auto;
    background: var(--bg);
    border-radius: 8px;
    padding: 0.75rem;
    display: none;
    border: 1px solid var(--border);
    position: relative;
}

.clear-files-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: var(--danger);
    color: white;
    border: none;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.2s;
    z-index: 5;
    padding: 0;
    line-height: 1;
}

.clear-files-btn:hover {
    background-color: #dc2626;
    transform: scale(1.1);
}

.file-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    transition: color 0.2s;
}

.file-item:hover {
    color: var(--text);
}

.file-item:last-child {
    border-bottom: none;
}

/* Controls */
.controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.controls-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

select,
input {
    background-color: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.875rem;
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
    width: 100%;
    font-family: inherit;
}

select:focus,
input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

select:hover,
input:hover {
    border-color: var(--primary);
}

/* Buttons */
.btn {
    width: 100%;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

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

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-cancel {
    background-color: var(--danger);
    color: white;
    margin-top: 0.5rem;
}

.btn-cancel:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-secondary {
    background-color: var(--surface-elevated);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: #2a2a2a;
    border-color: var(--text-muted);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    margin-right: 0.5rem;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.full-width {
    grid-column: span 1;
}

/* Progress (legacy - now using overlay) */
.progress-container {
    margin-top: 1.5rem;
    display: none;
    padding: 1rem;
    background-color: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.progress-bar-bg {
    background-color: var(--surface);
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-bar-fill {
    background: linear-gradient(90deg, var(--primary), #818cf8);
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 3px;
}

.progress-text {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    border: 1px solid var(--border);
    animation: slideUp 0.3s ease;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.success-icon {
    font-size: 3.5rem;
    display: block;
    margin-bottom: 1rem;
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.modal-subtext {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.modal-body {
    margin-bottom: 1.5rem;
}

.download-info {
    background-color: var(--bg);
    padding: 1.25rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.download-filename {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
    word-break: break-all;
}

.download-size {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .preview-section {
        position: relative;
        top: 0;
    }
    
    .controls-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    body {
        padding: 15px;
    }

    .app-title {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .preview-section,
    .controls-section {
        padding: 1rem;
    }

    .dropzone {
        padding: 2rem 1rem;
    }

    .modal-content {
        padding: 1.5rem;
    }

    .modal-actions {
        grid-template-columns: 1fr;
    }

    .preview-icon {
        font-size: 3rem;
    }

    .dropzone-icon {
        font-size: 2rem;
    }
}

/* Custom Scrollbar */
.file-list::-webkit-scrollbar {
    width: 6px;
}

.file-list::-webkit-scrollbar-track {
    background: var(--surface);
    border-radius: 3px;
}

.file-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.file-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.hidden {
    display: none;
}
