/* ===================================
   RESET E VARIÁVEIS
   =================================== */

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

:root {
    /* Cores principais */
    --primary: #E1306C;
    --secondary: #5851DB;
    --accent: #FFC107;
    --success: #10B981;
    --error: #EF4444;

    /* Cores Instagram */
    --ig-border: #DBDBDB;
    --ig-text: #262626;
    --ig-text-light: #8E8E8E;
    --ig-background: #FAFAFA;

    /* Cores UI */
    --dark: #262626;
    --light: #FAFAFA;
    --white: #FFFFFF;
    --gray-100: #F5F5F5;
    --gray-200: #EEEEEE;
    --gray-300: #E0E0E0;
    --gray-400: #BDBDBD;
    --gray-500: #9E9E9E;

    /* Fontes */
    --font-heading: 'Poppins', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Sombras */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);

    /* Transições */
    --transition: all 0.3s ease;
}

body {
    font-family: var(--font-body);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--dark);
    line-height: 1.6;
}

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

/* ===================================
   HEADER
   =================================== */

.header {
    background: var(--white);
    padding: 20px 0;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 2rem;
    animation: pulse 2s infinite;
}

.logo h1 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    color: var(--gray-500);
    font-style: italic;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ===================================
   MAIN CONTENT
   =================================== */

.main {
    padding: 40px 0;
    min-height: calc(100vh - 200px);
}

.card {
    background: var(--white);
    border-radius: 16px;
    padding: 32px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 8px;
    text-align: center;
}

.section-subtitle {
    color: var(--gray-500);
    text-align: center;
    margin-bottom: 24px;
    font-size: 1rem;
}

/* ===================================
   PROMPT SECTION
   =================================== */

.prompt-input-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.prompt-textarea {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--gray-300);
    border-radius: 12px;
    font-family: var(--font-body);
    font-size: 1rem;
    resize: vertical;
    min-height: 120px;
    transition: var(--transition);
}

.prompt-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(225, 48, 108, 0.1);
}

.prompt-textarea::placeholder {
    color: var(--gray-400);
}

/* Botões */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-icon {
    font-size: 1.2rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary {
    background: var(--gray-200);
    color: var(--dark);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-success {
    background: var(--success);
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Exemplos de prompts */
.examples {
    background: var(--gray-100);
    padding: 16px;
    border-radius: 12px;
}

.examples-title {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 12px;
}

.examples-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.example-chip {
    padding: 8px 16px;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.example-chip:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* ===================================
   IMAGE UPLOAD SECTION
   =================================== */

/* Separador "OU" */
.section-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 32px 0;
}

.divider-line {
    flex: 1;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gray-300), transparent);
}

.divider-text {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--gray-400);
    padding: 0 10px;
}

/* Upload Section */
.image-upload-section {
    margin-bottom: 24px;
}

/* Grid de Imagens */
.image-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 16px;
    list-style: none;
    padding: 0;
}

.image-slot {
    position: relative;
    aspect-ratio: 1;
    border: 3px dashed var(--primary);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    background: var(--white);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-slot:hover {
    border-color: var(--secondary);
    background: rgba(88, 81, 219, 0.05);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(88, 81, 219, 0.2);
}

.image-slot.has-image {
    border-style: solid;
    border-color: var(--success);
    cursor: default;
}

.image-slot.has-image:hover {
    transform: none;
}

/* Placeholder */
.image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    gap: 8px;
    padding: 20px;
    text-align: center;
}

.placeholder-icon {
    font-size: 3rem;
    opacity: 0.6;
}

.placeholder-text {
    font-size: 0.9rem;
    color: var(--primary);
    font-weight: 600;
}

/* Preview da Imagem */
.image-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Botão Remover */
.remove-image-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9);
    border: none;
    color: white;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 10;
}

.remove-image-btn:hover {
    background: var(--error);
    transform: scale(1.1);
}

.remove-image-btn span {
    display: block;
    transform: translateY(-1px);
}

/* Info de Upload */
.upload-info {
    text-align: center;
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 12px;
}

/* ===================================
   LOADING SECTION
   =================================== */

.loading-card {
    text-align: center;
}

.loading-spinner {
    margin: 0 auto 24px;
}

.spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto;
    border: 4px solid var(--gray-200);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
}

.loading-subtitle {
    color: var(--gray-500);
    margin-bottom: 32px;
}

.loading-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 300px;
    margin: 0 auto;
}

.loading-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--gray-100);
    border-radius: 8px;
    animation: fadeIn 0.5s ease;
}

.step-icon {
    font-size: 1.5rem;
}

.step-text {
    color: var(--gray-500);
    font-size: 0.95rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===================================
   PREVIEW SECTION (Instagram Mock)
   =================================== */

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

.instagram-mock {
    background: var(--white);
    border: 1px solid var(--ig-border);
    border-radius: 8px;
    overflow: hidden;
    margin: 24px 0;
    box-shadow: var(--shadow-md);
}

/* Header do Instagram */
.ig-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--ig-border);
}

.ig-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ig-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.ig-username {
    font-weight: 600;
    color: var(--ig-text);
    font-size: 0.9rem;
}

.ig-more {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--ig-text);
}

/* Imagem do post */
.ig-image-container {
    width: 100%;
    aspect-ratio: 1;
    background: var(--gray-100);
    position: relative;
    overflow: hidden;
}

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

/* Ações (curtir, comentar, etc) */
.ig-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    border-bottom: 1px solid var(--ig-border);
}

.ig-actions-left {
    display: flex;
    gap: 16px;
}

.ig-action-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.ig-action-btn:hover {
    transform: scale(1.1);
}

/* Legenda */
.ig-caption {
    padding: 12px 16px;
    color: var(--ig-text);
    font-size: 0.9rem;
    line-height: 1.5;
}

.ig-username-bold {
    font-weight: 600;
    margin-right: 8px;
}

.ig-caption-text {
    white-space: pre-wrap;
}

/* Timestamp */
.ig-timestamp {
    padding: 8px 16px;
    color: var(--ig-text-light);
    font-size: 0.75rem;
}

/* Ações do preview */
.preview-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===================================
   SUCCESS E ERROR SECTIONS
   =================================== */

.success-card,
.error-card {
    text-align: center;
    padding: 48px 32px;
}

.success-icon,
.error-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.success-title,
.error-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.success-title {
    color: var(--success);
}

.error-title {
    color: var(--error);
}

.success-subtitle,
.error-subtitle {
    color: var(--gray-500);
    margin-bottom: 24px;
}

/* ===================================
   FOOTER
   =================================== */

.footer {
    background: var(--white);
    padding: 24px 0;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.footer-text {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.footer-version {
    color: var(--gray-400);
    font-size: 0.8rem;
}

/* ===================================
   UTILITY CLASSES
   =================================== */

.hidden {
    display: none !important;
}

/* ===================================
   RESPONSIVE
   =================================== */

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

    .logo h1 {
        font-size: 1.5rem;
    }

    .card {
        padding: 24px;
    }

    .section-title {
        font-size: 1.5rem;
    }

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

    .btn {
        width: 100%;
    }

    .examples-list {
        flex-direction: column;
    }

    .example-chip {
        width: 100%;
        text-align: left;
    }

    /* Image grid responsivo */
    .image-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .section-divider {
        margin: 24px 0;
    }

    .divider-text {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .logo h1 {
        font-size: 1.3rem;
    }

    .card {
        padding: 20px;
        border-radius: 12px;
    }
}
