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

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --bg-color: #f9fafb;
    --card-bg: #ffffff;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--bg-color);
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.header-branding {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.berta-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: white;
    border-radius: 20px;
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
}

.berta-badge:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.berta-badge-logo {
    width: 24px;
    height: 24px;
    border-radius: 4px;
}

.berta-badge span {
    color: #6b7280;
    font-size: 0.9rem;
    font-weight: 600;
}

h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-light);
}

/* Ad Containers */
.ad-container {
    margin: 30px 0;
    padding: 20px;
    background: #f3f4f6;
    border-radius: 8px;
    text-align: center;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-container::before {
    content: "Advertisement";
    position: absolute;
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: -40px;
}

/* Upload Section */
.upload-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.upload-area {
    background: var(--card-bg);
    border: 3px dashed var(--border-color);
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary-color);
    background: #f0f9ff;
    transform: translateY(-2px);
}

.upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    color: var(--primary-color);
}

.upload-area h2 {
    color: var(--text-color);
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.upload-area p {
    color: var(--text-light);
    margin-bottom: 5px;
}

.file-info {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 15px;
}

/* Options Panel */
.options-panel {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.options-panel h3 {
    margin-bottom: 20px;
    color: var(--text-color);
}

.option-group {
    margin-bottom: 20px;
}

.option-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
}

.scale-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

#scaleInput {
    flex: 1;
    height: 6px;
    border-radius: 5px;
    outline: none;
    background: var(--border-color);
}

#scaleInput::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

#scaleValue {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 40px;
}

.bg-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 400;
}

.radio-label input[type="radio"] {
    cursor: pointer;
}

#bgColorPicker {
    width: 100%;
    height: 40px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
}

#bgColorPicker:enabled {
    border-color: var(--primary-color);
}

.format-select {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.format-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* File List */
.file-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.file-item {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    position: relative;
    transition: transform 0.2s ease;
}

.file-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.file-preview {
    width: 100%;
    height: 150px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

.file-name {
    font-size: 0.9rem;
    color: var(--text-color);
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-status {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 12px;
}

.file-status.converting {
    color: var(--primary-color);
}

.file-status.success {
    color: var(--secondary-color);
}

.file-status.error {
    color: var(--danger-color);
}

.file-actions {
    display: flex;
    gap: 10px;
}

.file-actions button {
    flex: 1;
}

.remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.remove-btn:hover {
    opacity: 1;
}

/* Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 40px;
}

.btn {
    padding: 14px 32px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn:active {
    transform: translateY(0);
}

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

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

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

.btn-secondary:hover {
    background: #059669;
}

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.85rem;
}

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

/* Info Section */
.info-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 40px;
}

.info-card {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.info-card h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.info-card h3 {
    color: var(--text-color);
    margin: 20px 0 10px;
    font-size: 1.2rem;
}

.info-card p {
    color: var(--text-light);
    margin-bottom: 15px;
}

.info-card ul,
.info-card ol {
    margin-left: 20px;
    color: var(--text-color);
}

.info-card li {
    margin-bottom: 8px;
}

.note {
    background: #fef3c7;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #f59e0b;
    margin-top: 15px;
}

/* Support Section */
.support-section {
    margin: 50px 0 30px;
}

.support-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    color: white;
    box-shadow: var(--shadow-lg);
}

.support-card h2 {
    color: white;
    margin-bottom: 15px;
    font-size: 2rem;
}

.support-card p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 25px;
    font-size: 1.1rem;
}

.support-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.support-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 32px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.support-icon {
    width: 24px;
    height: 24px;
}

.kofi-btn {
    background: #FF5E5B;
    color: white;
}

.kofi-btn:hover {
    background: #ee4744;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(255, 94, 91, 0.4);
}

.support-info {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    margin-bottom: 15px;
}

/* Berta.one Tools Section */
.berta-tools-section {
    margin: 50px 0;
    padding: 40px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 16px;
}

.berta-header {
    text-align: center;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.berta-logo {
    width: 48px;
    height: 48px;
    border-radius: 8px;
}

.berta-header h2 {
    color: #1f2937;
    margin: 0;
    font-size: 2rem;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.tool-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    border: 2px solid transparent;
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.tool-card.berta-main:hover {
    border-color: #667eea;
}

.tool-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.tool-card h3 {
    color: var(--text-color);
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.tool-card p {
    color: var(--text-light);
    margin-bottom: 15px;
    line-height: 1.5;
}

.tool-link {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.95rem;
}

.berta-cta {
    text-align: center;
    margin-top: 30px;
    padding-top: 25px;
    border-top: 2px solid #e0f2fe;
}

.berta-cta p {
    font-size: 1.1rem;
    color: var(--text-color);
}

.berta-link {
    color: var(--primary-color);
    font-weight: 700;
    text-decoration: none;
    border-bottom: 2px solid var(--primary-color);
    transition: all 0.2s;
}

.berta-link:hover {
    color: #4338ca;
    border-bottom-color: #4338ca;
}

/* Footer */
footer {
    margin-top: 50px;
    padding: 40px 0 20px;
    border-top: 2px solid var(--border-color);
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.footer-links {
    text-align: center;
}

.footer-logo {
    width: 32px;
    height: 32px;
    margin-bottom: 15px;
    border-radius: 6px;
}

.footer-links p {
    color: var(--text-light);
    margin: 10px 0;
}

.footer-links a {
    color: var(--primary-color);
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}

.footer-company {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.company-info {
    font-size: 0.85rem;
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 15px;
}

.company-link {
    font-weight: 600;
    color: var(--text-color);
    text-decoration: none;
}

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

.company-info a {
    color: var(--primary-color);
    text-decoration: none;
}

.company-info a:hover {
    text-decoration: underline;
}

.berta-attribution {
    font-size: 0.9rem;
    color: var(--text-light);
}

.berta-attribution a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.berta-attribution a:hover {
    text-decoration: underline;
}

.small {
    font-size: 0.85rem;
    margin-top: 5px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 2rem;
    }

    .upload-section {
        grid-template-columns: 1fr;
    }

    .upload-area {
        padding: 40px 20px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons button {
        width: 100%;
    }

    .file-list {
        grid-template-columns: 1fr;
    }

    .info-section {
        grid-template-columns: 1fr;
    }
}

/* Loading Spinner */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
