/* AI Book Cover Studio Styles */
.aibc-container {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: #0f172a;
    color: #e2e8f0;
    border-radius: 1rem;
    padding: 2rem;
    margin: 2rem 0;
}

.aibc-header {
    text-align: center;
    margin-bottom: 3rem;
}

.aibc-title {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #818cf8, #22d3ee);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.aibc-subtitle {
    color: #94a3b8;
    font-size: 1.125rem;
}

.aibc-input-section {
    max-width: 48rem;
    margin: 0 auto 3rem;
    background-color: rgba(30, 41, 59, 0.5);
    border: 1px solid #334155;
    border-radius: 1rem;
    padding: 1.5rem;
}

.aibc-textarea {
    width: 100%;
    background-color: #1e293b;
    border: 1px solid #475569;
    color: white;
    border-radius: 0.5rem;
    padding: 1rem;
    font-size: 1rem;
    margin-bottom: 1rem;
    resize: vertical;
    min-height: 100px;
}

.aibc-textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.aibc-btn-primary {
    width: 100%;
    background-color: #6366f1;
    color: white;
    font-weight: 600;
    padding: 1rem 2rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.aibc-btn-primary:hover:not(:disabled) {
    background-color: #4f46e5;
    transform: scale(1.02);
}

.aibc-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.aibc-progress {
    text-align: center;
    color: #94a3b8;
    margin-top: 1rem;
    display: none;
}

.aibc-progress.visible {
    display: block;
}

.aibc-results {
    display: none;
    background-color: rgba(30, 41, 59, 0.6);
    border: 1px solid #334155;
    border-radius: 1rem;
    padding: 1.5rem;
}

.aibc-results.visible {
    display: block;
}

.aibc-gallery-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: #818cf8;
    margin-bottom: 1.5rem;
}

.aibc-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.aibc-card {
    background-color: rgba(15, 23, 42, 0.7);
    border-radius: 0.5rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.aibc-image-container {
    aspect-ratio: 9 / 16;
    background-color: #1e293b;
    border-radius: 0.5rem;
    overflow: hidden;
    position: relative;
}

.aibc-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.aibc-card-loader {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
}

.aibc-loader {
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid #6366f1;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.aibc-card-title {
    font-weight: 700;
    font-size: 1.125rem;
    text-align: center;
    color: #cbd5e1;
}

.aibc-button-group {
    display: flex;
    gap: 0.5rem;
}

.aibc-btn-secondary {
    flex: 1;
    background-color: #334155;
    color: white;
    border: none;
    border-radius: 0.375rem;
    padding: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.aibc-btn-secondary:hover {
    background-color: #475569;
}

.aibc-modify-input {
    width: 100%;
    background-color: #1e293b;
    border: 1px solid #475569;
    border-radius: 0.375rem;
    padding: 0.5rem;
    font-size: 0.875rem;
    color: white;
}

.aibc-modify-input:focus {
    outline: none;
    border-color: #6366f1;
}

.aibc-btn-modify {
    width: 100%;
    background-color: #6366f1;
    color: white;
    font-weight: 600;
    border: none;
    border-radius: 0.375rem;
    padding: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.aibc-btn-modify:hover:not(:disabled) {
    background-color: #4f46e5;
}

.aibc-btn-download {
    width: 100%;
    background-color: #06b6d4;
    color: white;
    font-weight: 600;
    border: none;
    border-radius: 0.375rem;
    padding: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.aibc-btn-download:hover {
    background-color: #0891b2;
}

.aibc-error {
    display: none;
    max-width: 48rem;
    margin: 2rem auto;
    background-color: rgba(127, 29, 29, 0.5);
    border: 1px solid #dc2626;
    color: #fca5a5;
    padding: 1rem;
    border-radius: 0.5rem;
}

.aibc-error.visible {
    display: block;
}

.aibc-modal {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.aibc-modal.visible {
    display: flex;
}

.aibc-modal-content {
    background-color: #1e293b;
    border-radius: 0.5rem;
    max-width: 42rem;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.aibc-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #334155;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.aibc-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #818cf8;
}

.aibc-modal-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
}

.aibc-modal-close:hover {
    color: white;
}

.aibc-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    color: #cbd5e1;
    line-height: 1.6;
    white-space: pre-wrap;
}

@media (max-width: 640px) {
    .aibc-title {
        font-size: 2rem;
    }
    
    .aibc-gallery {
        grid-template-columns: 1fr;
    }
}