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

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 20px;
    color: #424242;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: #424242;
    margin-bottom: 32px;
    padding: 24px;
}

header h1 {
    font-size: 2rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: #212121;
}

.subtitle {
    font-size: 1rem;
    color: #757575;
    font-weight: 400;
}

main {
    background: #ffffff;
    border-radius: 8px;
    padding: 32px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.08);
}

.form-section {
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 24px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    color: #616161;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input[type="text"],
input[type="url"],
input[type="number"] {
    width: 100%;
    padding: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 16px;
    background: #fafafa;
    transition: all 0.2s ease;
}

input:hover {
    border-color: #bdbdbd;
}

input:focus {
    outline: none;
    border-color: #616161;
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(97, 97, 97, 0.1);
}

input::placeholder {
    color: #9e9e9e;
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: #424242;
    color: white;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.btn-primary:hover {
    background: #616161;
    box-shadow: 0 4px 8px rgba(0,0,0,0.25);
}

.btn-primary:active {
    background: #212121;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-secondary {
    background: #e0e0e0;
    color: #424242;
}

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

.status-section,
.result-section,
.error-section {
    margin-bottom: 24px;
}

.status-card,
.result-card {
    padding: 24px;
    border-radius: 4px;
    background: #fafafa;
    border: 1px solid #e0e0e0;
}

.status-card h2,
.result-card h2 {
    margin-bottom: 20px;
    color: #212121;
    font-weight: 500;
    font-size: 1.25rem;
}

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

.progress-fill {
    height: 100%;
    background: #616161;
    transition: width 0.5s ease;
    border-radius: 4px;
}

.status-text {
    font-size: 1rem;
    color: #757575;
    margin-bottom: 8px;
}

.status-percentage {
    font-size: 2rem;
    font-weight: 500;
    color: #424242;
    text-align: center;
}

.result-card.success {
    background: #fafafa;
    border: 1px solid #9e9e9e;
    border-left: 4px solid #4caf50;
}

.result-card.success h2 {
    color: #2e7d32;
}

.result-card.error {
    background: #fafafa;
    border: 1px solid #9e9e9e;
    border-left: 4px solid #f44336;
}

.result-card.error h2 {
    color: #c62828;
}

.result-details {
    margin: 20px 0;
}

.result-details p {
    margin: 12px 0;
    font-size: 1rem;
    color: #616161;
}

.result-details strong {
    color: #424242;
}

.result-details a {
    color: #424242;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid #bdbdbd;
    transition: border-color 0.2s;
}

.result-details a:hover {
    border-color: #424242;
}

.error-message {
    color: #c62828;
    background: #ffffff;
    padding: 16px;
    border-radius: 4px;
    margin: 16px 0;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.875rem;
    border: 1px solid #e0e0e0;
}

.jobs-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #e0e0e0;
}

.jobs-section h2 {
    margin-bottom: 16px;
    color: #424242;
    font-weight: 500;
    font-size: 1.125rem;
}

.jobs-list {
    display: grid;
    gap: 12px;
}

.job-item {
    padding: 16px;
    background: #fafafa;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    border-left: 3px solid #9e9e9e;
    transition: box-shadow 0.2s;
}

.job-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.job-item.completed {
    border-left-color: #4caf50;
}

.job-item.failed {
    border-left-color: #f44336;
}

.job-item.running,
.job-item.in_progress {
    border-left-color: #ff9800;
}

.job-item.queued {
    border-left-color: #2196f3;
}

.job-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.job-keyword {
    font-weight: 500;
    color: #212121;
    font-size: 0.9375rem;
}

.job-status {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.job-status.completed {
    background: #e8f5e9;
    color: #2e7d32;
}

.job-status.failed {
    background: #ffebee;
    color: #c62828;
}

.job-status.running,
.job-status.in_progress {
    background: #fff3e0;
    color: #e65100;
}

.job-status.queued {
    background: #e3f2fd;
    color: #1565c0;
}

.job-message {
    font-size: 0.875rem;
    color: #757575;
}

.job-message a {
    color: #424242;
    text-decoration: none;
    border-bottom: 1px solid #bdbdbd;
}

footer {
    text-align: center;
    color: #9e9e9e;
    margin-top: 32px;
    font-size: 0.875rem;
}

/* Approval Sections */
.approval-section {
    margin-bottom: 24px;
}

.approval-card {
    padding: 24px;
    border-radius: 4px;
    background: #fafafa;
    border: 1px solid #e0e0e0;
}

.approval-card h2 {
    margin-bottom: 16px;
    color: #212121;
    font-weight: 500;
    font-size: 1.25rem;
}

/* Step Indicator */
.step-indicator {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
}

.step-indicator .step {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8125rem;
    color: #9e9e9e;
    background: #eeeeee;
    font-weight: 500;
}

.step-indicator .step.active {
    background: #424242;
    color: white;
}

.step-indicator .step.completed {
    background: #4caf50;
    color: white;
}

/* Article Preview */
.article-preview {
    max-height: 400px;
    overflow-y: auto;
    padding: 20px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 20px;
}

.article-preview h3 {
    margin-bottom: 12px;
    color: #212121;
    font-size: 1.25rem;
}

.article-excerpt {
    color: #757575;
    font-style: italic;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
}

.article-content {
    font-size: 1rem;
    line-height: 1.6;
    color: #424242;
}

.article-content h2,
.article-content h3 {
    margin: 16px 0 8px;
    color: #212121;
}

.article-content p {
    margin-bottom: 12px;
}

.article-content ul,
.article-content ol {
    margin: 12px 0;
    padding-left: 24px;
}

.loading-text {
    color: #9e9e9e;
    text-align: center;
    padding: 20px;
}

.instruction {
    color: #757575;
    margin-bottom: 16px;
    font-size: 0.9375rem;
}

/* Images Grid */
.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.image-card {
    position: relative;
    aspect-ratio: 9/16;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease;
    background: #eeeeee;
}

.image-card:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.image-card.selected {
    border-color: #ff9800;
    box-shadow: 0 0 0 2px rgba(255, 152, 0, 0.3);
}

.image-card.regenerating {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.image-card .overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Final Preview */
.final-preview-container {
    height: 500px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 20px;
    background: white;
}

.final-preview-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Approval Actions */
.approval-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-success {
    background: #4caf50;
    color: white;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

.btn-success:hover {
    background: #43a047;
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.4);
}

.btn-warning {
    background: #ff9800;
    color: white;
    box-shadow: 0 2px 4px rgba(255, 152, 0, 0.3);
}

.btn-warning:hover {
    background: #f57c00;
    box-shadow: 0 4px 8px rgba(255, 152, 0, 0.4);
}

.btn-warning:disabled {
    background: #e0e0e0;
    color: #9e9e9e;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-danger {
    background: #f44336;
    color: white;
    box-shadow: 0 2px 4px rgba(244, 67, 54, 0.3);
}

.btn-danger:hover {
    background: #e53935;
    box-shadow: 0 4px 8px rgba(244, 67, 54, 0.4);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 24px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-content h3 {
    margin-bottom: 16px;
    color: #212121;
}

.modal-content textarea {
    width: 100%;
    height: 120px;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 16px;
    resize: vertical;
    font-family: inherit;
    font-size: 1rem;
}

.modal-content textarea:focus {
    outline: none;
    border-color: #616161;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Awaiting status for jobs */
.job-item.awaiting {
    border-left-color: #9c27b0;
}

.job-status.awaiting {
    background: #f3e5f5;
    color: #6a1b9a;
}

.job-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-delete {
    background: transparent;
    border: 1px solid #e0e0e0;
    color: #9e9e9e;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-delete:hover {
    background: #ffebee;
    border-color: #f44336;
    color: #f44336;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }

    .container {
        padding: 8px;
    }

    main {
        padding: 20px;
        border-radius: 4px;
    }

    input[type="text"],
    input[type="url"],
    input[type="number"] {
        padding: 14px;
    }

    .step-indicator {
        gap: 8px;
    }

    .step-indicator .step {
        padding: 6px 12px;
        font-size: 0.75rem;
    }

    .images-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }

    .approval-actions {
        flex-direction: column;
    }

    .approval-actions .btn {
        width: 100%;
    }

    .final-preview-container {
        height: 350px;
    }
}
