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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f7;
    color: #1d1d1f;
    line-height: 1.6;
}

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

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

.title {
    font-size: 34px;
    font-weight: 700;
    color: #1d1d1f;
}

.settings-btn {
    background: #007aff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-btn:hover {
    background: #0056cc;
    transform: translateY(-1px);
}

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

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

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

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #8e8e93;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #1d1d1f;
}

/* API Tabs */
.api-tabs {
    display: flex;
    background: #f2f2f7;
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #8e8e93;
}

.tab-btn.active {
    background: white;
    color: #1d1d1f;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.input-field {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d1d1d6;
    border-radius: 10px;
    font-size: 16px;
    background: white;
    transition: border-color 0.2s ease;
}

.input-field:focus {
    outline: none;
    border-color: #007aff;
}

.btn-save {
    background: #007aff;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-save:hover {
    background: #0056cc;
}

/* API Tutorial */
.api-tutorial {
    margin-top: 10px;
}

.tutorial-content {
    font-size: 12px;
    line-height: 1.4;
    color: #8e8e93;
}

.tutorial-hint {
    margin: 0;
}

.tutorial-content a {
    color: #007aff;
    text-decoration: none;
}

.tutorial-content a:hover {
    text-decoration: underline;
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.section {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #1d1d1f;
}

.sub-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #1d1d1f;
}

/* Photo Types */
.photo-types {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.photo-type-btn {
    flex: 1;
    background: #f2f2f7;
    border: none;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #1d1d1f;
}

.photo-type-btn:hover {
    background: #e5e5ea;
}

.photo-type-btn.active {
    background: #007aff;
    color: white;
}

/* Reference Images */
.reference-images {
    display: flex;
    gap: 12px;
}

.reference-item {
    flex: 1;
    aspect-ratio: 3/4;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.reference-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.reference-item.selected {
    border: 3px solid #007aff;
}

.reference-placeholder {
    width: 100%;
    height: 100%;
    background: #d1d1d6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8e8e93;
    font-size: 14px;
    font-weight: 500;
}

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

/* Upload Area */
.upload-area {
    position: relative;
    aspect-ratio: 16/9;
    border: 2px dashed #d1d1d6;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    margin-bottom: 20px;
}

.upload-area:hover {
    border-color: #007aff;
    background: rgba(0, 122, 255, 0.05);
}

.upload-area.dragover {
    border-color: #007aff;
    background: rgba(0, 122, 255, 0.1);
}

.upload-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-placeholder {
    width: 100%;
    height: 100%;
    background: #d1d1d6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8e8e93;
    font-size: 14px;
    font-weight: 500;
}

.uploaded-image {
    position: relative;
    width: 100%;
    height: 100%;
}

.uploaded-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s ease;
}

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

/* Custom Requirements */
.custom-requirements {
    margin-top: 5px;
}

.custom-input {
    width: 100%;
}

.prompt-textarea {
    width: 100%;
    min-height: 80px;
    padding: 16px;
    border: 1px solid #d1d1d6;
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    background: #f9f9f9;
    transition: all 0.2s ease;
}

.prompt-textarea:focus {
    outline: none;
    border-color: #007aff;
    background: white;
}

.prompt-textarea::placeholder {
    color: #8e8e93;
}

/* Generate Section */
.generate-section {
    text-align: center;
    margin: 30px 0;
}

.generate-button {
    background: linear-gradient(135deg, #007aff, #0056cc);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 122, 255, 0.3);
}

.generate-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.4);
}

.generate-button:disabled {
    background: #c7c7cc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Error Message */
.error-message {
    margin-top: 16px;
    padding: 12px 16px;
    background: #fff2f2;
    border: 1px solid #ffcdd2;
    border-radius: 12px;
    color: #d32f2f;
    font-size: 14px;
    text-align: left;
    margin-left: auto;
    margin-right: auto;
}

.error-content {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.error-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

.error-text {
    flex: 1;
    line-height: 1.4;
}

.generate-button:hover:not(:disabled) {
    background: #0056cc;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 122, 255, 0.4);
}

.generate-button:disabled {
    background: #d1d1d6;
    color: #8e8e93;
    cursor: not-allowed;
    box-shadow: none;
}

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

.result-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.loading {
    text-align: center;
    padding: 40px 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f2f2f7;
    border-top: 3px solid #007aff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.result-content {
    text-align: center;
}

.result-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-action {
    background: #f2f2f7;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-action:hover {
    background: #e5e5ea;
}

.btn-download {
    color: #007aff;
}

.btn-regenerate {
    color: #ff9500;
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 20px;
    border-radius: 12px;
    color: white;
    font-weight: 500;
    z-index: 1001;
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.notification.success {
    background: #34c759;
}

.notification.error {
    background: #ff3b30;
}

.notification.info {
    background: #007aff;
}

.notification-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.notification-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.slideOut {
    animation: slideOut 0.3s ease forwards;
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

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

    .title {
        font-size: 28px;
    }

    .reference-images {
        flex-direction: column;
        gap: 10px;
    }

    .reference-item {
        aspect-ratio: 16/9;
    }

    .photo-types {
        flex-direction: column;
    }

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

    .modal-content {
        margin: 20px;
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .generate-button {
        width: 100%;
    }
}