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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #ffffff;
    color: #000000;
    transition: background 0.3s, color 0.3s;
}

body.dark-mode {
    background: #000000;
    color: #ffffff;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 32px;
    font-weight: 600;
}

.dark-mode-toggle {
    background: none;
    border: 1px solid #e0e0e0;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s;
}

.dark-mode-toggle:hover {
    background: #f5f5f5;
}

body.dark-mode .dark-mode-toggle {
    border-color: #333333;
}

body.dark-mode .dark-mode-toggle:hover {
    background: #1a1a1a;
}

/* Input Grid (Bento Layout) */
.input-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 968px) {
    .input-grid {
        grid-template-columns: 1fr;
    }
}

/* Cards */
.card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s;
}

body.dark-mode .card {
    background: #0a0a0a;
    border-color: #333333;
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.02);
}

.card h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
}

/* Upload Dropzone */
.dropzone {
    border: 2px dashed #e0e0e0;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.dropzone:hover {
    border-color: #000000;
    background: #fafafa;
}

body.dark-mode .dropzone {
    border-color: #333333;
}

body.dark-mode .dropzone:hover {
    border-color: #666666;
    background: #0f0f0f;
}

.dropzone.dragover {
    border-color: #000000;
    background: #f5f5f5;
}

body.dark-mode .dropzone.dragover {
    border-color: #666666;
    background: #1a1a1a;
}

.dropzone-content svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.dropzone-content p {
    margin: 8px 0;
    font-size: 14px;
}

.dropzone-content .small {
    font-size: 12px;
    opacity: 0.6;
}

/* Thumbnails */
.thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.thumbnail {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

body.dark-mode .thumbnail {
    border-color: #333333;
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* Campaign Brief */
textarea {
    width: 100%;
    min-height: 280px;
    padding: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    background: #ffffff;
    color: #000000;
    transition: all 0.3s;
}

textarea:focus {
    outline: none;
    border-color: #000000;
}

body.dark-mode textarea {
    background: #0a0a0a;
    border-color: #333333;
    color: #ffffff;
}

body.dark-mode textarea:focus {
    border-color: #666666;
}

.char-count {
    margin-top: 8px;
    font-size: 12px;
    opacity: 0.6;
    text-align: right;
}

/* Generate Section */
.generate-section {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 40px;
}

@media (max-width: 768px) {
    .generate-section {
        flex-direction: column;
    }
}

.campaign-name-input {
    flex: 1;
    padding: 16px 20px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    font-size: 14px;
    background: #ffffff;
    color: #000000;
    transition: all 0.3s;
}

.campaign-name-input:focus {
    outline: none;
    border-color: #000000;
}

body.dark-mode .campaign-name-input {
    background: #0a0a0a;
    border-color: #333333;
    color: #ffffff;
}

body.dark-mode .campaign-name-input:focus {
    border-color: #666666;
}

.generate-btn {
    padding: 16px 40px;
    background: #000000;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.generate-btn:hover:not(:disabled) {
    background: #333333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.generate-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

body.dark-mode .generate-btn {
    background: #ffffff;
    color: #000000;
}

body.dark-mode .generate-btn:hover:not(:disabled) {
    background: #e0e0e0;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.hidden {
    display: none;
}

.loading-content {
    background: #ffffff;
    padding: 48px;
    border-radius: 16px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

body.dark-mode .loading-content {
    background: #0a0a0a;
    border: 1px solid #333333;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e0e0e0;
    border-top-color: #000000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

body.dark-mode .spinner {
    border-color: #333333;
    border-top-color: #ffffff;
}

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

.loading-content h3 {
    font-size: 20px;
    margin-bottom: 12px;
}

.loading-content p {
    font-size: 14px;
    opacity: 0.7;
    margin-bottom: 24px;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
}

body.dark-mode .progress-bar {
    background: #333333;
}

.progress-fill {
    height: 100%;
    background: #000000;
    transition: width 0.3s;
    border-radius: 2px;
}

body.dark-mode .progress-fill {
    background: #ffffff;
}

/* Results Section */
.results-section {
    margin-top: 60px;
}

.results-section.hidden {
    display: none;
}

.results-section h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 24px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

@media (max-width: 1200px) {
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
}

.result-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s;
}

.result-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
}

body.dark-mode .result-card {
    background: #0a0a0a;
    border-color: #333333;
}

body.dark-mode .result-card:hover {
    box-shadow: 0 8px 24px rgba(255, 255, 255, 0.05);
}

.result-card img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
}

.result-info {
    padding: 20px;
}

.result-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.download-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #000000;
    color: #ffffff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.download-btn:hover {
    background: #333333;
}

body.dark-mode .download-btn {
    background: #ffffff;
    color: #000000;
}

body.dark-mode .download-btn:hover {
    background: #e0e0e0;
}
