/* AI Image-to-Prompt Generator Pro - Professional Styling */

.ai-prompt-container {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: radial-gradient(ellipse at top, #1e1b4b 0%, #0f0f23 100%);
    min-height: auto; /* Changed from 90vh to auto */
    color: #e2e8f0;
    position: relative;
    margin: 0 auto;
    border-radius: 12px;
    overflow: visible; /* Changed from hidden to visible */
    box-sizing: border-box;
    max-width: 1400px;
    padding-bottom: 2rem; /* Added bottom padding */
}

.ai-prompt-container * {
    box-sizing: border-box;
}

/* Header Styling */
.ai-prompt-header {
    text-align: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, #8b5cf6 0%, #06b6d4 100%);
    position: relative;
    overflow: hidden;
}

.ai-prompt-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" patternUnits="userSpaceOnUse" width="100" height="100"><circle cx="20" cy="20" r="0.5" fill="white" opacity="0.1"/><circle cx="80" cy="40" r="0.3" fill="white" opacity="0.1"/><circle cx="40" cy="80" r="0.4" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
}

.ai-prompt-header h1 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 800;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
    margin-top: 0;
}

.ai-prompt-header p {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    opacity: 0.9;
    position: relative;
    z-index: 1;
    margin-bottom: 0;
}

/* Main Layout */
.ai-prompt-main {
    max-width: 100%;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
}

@media (min-width: 1024px) {
    .ai-prompt-main {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
        padding: 2rem;
    }
}

/* Panel Styling */
.ai-prompt-panel {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: visible; /* Changed from hidden to visible */
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: auto; /* Added */
}

.panel-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    padding: 1.5rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.panel-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #f1f5f9;
    margin-top: 0;
}

.panel-header p {
    color: #94a3b8;
    font-size: 0.9rem;
    margin-bottom: 0;
}

.panel-content {
    flex: 1;
    padding: 1.5rem;
    overflow: visible; /* Changed from overflow-y: auto */
    max-height: none; /* Removed height constraint */
    min-height: auto; /* Added */
}

/* Form Styling */
.field-group {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 12px;
    position: relative;
    z-index: 1; /* Added */
}

.field-group::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #8b5cf6 50%, transparent 100%);
    border-radius: 12px 12px 0 0;
}

.field-label {
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Premium Selection Styling */
.premium-selection {
    border: 2px solid #8b5cf6;
    background: rgba(139, 92, 246, 0.1);
    z-index: 10; /* Added higher z-index */
    position: relative; /* Added */
}

.premium-selection .field-label {
    color: #a78bfa;
    font-size: 1rem;
}

/* FIXED: Select Styling with proper visibility */
.premium-select, .platform-select, select {
    width: 100%;
    padding: 0.75rem;
    margin: 0.5rem 0;
    background: #1e293b !important; /* Changed to darker background */
    border: 2px solid rgba(148, 163, 184, 0.4) !important; /* Stronger border */
    border-radius: 8px;
    color: #f8fafc !important; /* Brighter text */
    font-size: 0.9rem;
    transition: all 0.3s ease;
    font-family: inherit;
    position: relative;
    z-index: 5; /* Added z-index */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
}

/* Dropdown arrow styling */
.premium-select, .platform-select, select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f8fafc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 1em !important;
    padding-right: 2.5rem !important;
}

.premium-select {
    border: 2px solid #8b5cf6 !important;
    background: #1e293b !important;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b5cf6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 1em !important;
}

.premium-select:focus, .platform-select:focus, select:focus {
    outline: none !important;
    border-color: #8b5cf6 !important;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.3) !important;
    background: #1e293b !important;
    color: #f8fafc !important;
}

/* FIXED: Option styling for better visibility */
option {
    background: #1e293b !important;
    color: #f8fafc !important;
    padding: 0.5rem !important;
    border: none !important;
}

/* Ensure dropdowns are above other elements */
select:focus {
    z-index: 1000 !important;
    position: relative !important;
}

/* Upload Area */
.upload-area {
    border: 2px dashed rgba(148, 163, 184, 0.3);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.05);
}

.upload-zone {
    padding: 2rem;
    text-align: center;
    cursor: pointer !important;
    transition: all 0.3s ease;
    position: relative;
    user-select: none;
}

.upload-zone:hover {
    transform: scale(1.02);
    background: rgba(139, 92, 246, 0.1);
}

.upload-zone:active {
    transform: scale(0.98);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    pointer-events: none; /* Ensure clicks pass through to parent */
}

.upload-icon {
    font-size: 3rem;
    opacity: 0.7;
    pointer-events: none;
}

.upload-text {
    color: #cbd5e1;
    pointer-events: none;
}

.upload-text strong {
    color: #8b5cf6;
    font-size: 1.1rem;
}

.upload-text small {
    color: #94a3b8;
}

/* Image Preview */
.image-preview {
    margin-top: 1rem;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #8b5cf6;
}

.image-preview img {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: cover;
}

/* Preview container styling */
.preview-container {
    position: relative;
}

.preview-info {
    padding: 1rem;
    background: rgba(30, 41, 59, 0.9);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.file-name {
    font-weight: 500;
    color: #e2e8f0;
    font-size: 0.9rem;
}

.file-size {
    color: #94a3b8;
    font-size: 0.8rem;
}

.remove-image {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    color: #f87171;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.remove-image:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: translateY(-1px);
}

/* Checkbox Grid */
.checkbox-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

@media (min-width: 640px) {
    .checkbox-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.checkbox-item:hover {
    background: rgba(30, 41, 59, 0.8);
    border-color: #8b5cf6;
}

.checkbox-item input[type="checkbox"] {
    width: auto;
    margin: 0;
    accent-color: #8b5cf6;
}

.checkbox-item span {
    font-size: 0.85rem;
    color: #cbd5e1;
    cursor: pointer;
}

/* Generate Button */
.generate-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    margin-top: 1.5rem;
    transition: all 0.3s ease;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(16, 185, 129, 0.4);
}

.generate-btn:disabled {
    background: #475569;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Results Container */
.results-container {
    min-height: 300px;
    background: rgba(15, 23, 42, 0.6);
    border: 2px dashed rgba(148, 163, 184, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    position: relative;
    background-image:
        linear-gradient(90deg, rgba(139, 92, 246, 0.1) 1px, transparent 1px),
        linear-gradient(180deg, rgba(139, 92, 246, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
}

.results-container.has-content {
    background: rgba(30, 58, 138, 0.2);
    border-color: #3b82f6;
    color: #e0f2fe;
}

.results-placeholder {
    text-align: center;
    padding: 2rem 0;
}

.placeholder-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.placeholder-text h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: #f1f5f9;
}

.placeholder-text p {
    color: #94a3b8;
    margin-bottom: 2rem;
}

.features-preview h4 {
    color: #8b5cf6;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.features-preview ul {
    text-align: left;
    display: inline-block;
    color: #cbd5e1;
    font-size: 0.9rem;
    line-height: 1.6;
}

.features-preview li {
    margin-bottom: 0.5rem;
}

/* Generated Prompt Display */
.prompt-result {
    background: rgba(30, 58, 138, 0.3);
    border: 1px solid #3b82f6;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.prompt-result h4 {
    color: #60a5fa;
    margin-bottom: 0.75rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.prompt-text {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    padding: 1rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.negative-prompt {
    margin-top: 1rem;
}

.negative-prompt h4 {
    color: #f87171;
}

.negative-prompt .prompt-text {
    border-color: rgba(248, 113, 113, 0.3);
}

/* Action Buttons */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

@media (min-width: 640px) {
    .action-buttons {
        grid-template-columns: repeat(3, 1fr);
    }
}

.action-btn {
    background: rgba(71, 85, 105, 0.5);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.2);
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    text-align: center;
    font-family: inherit;
}

.action-btn:hover {
    background: rgba(71, 85, 105, 0.8);
    border-color: #8b5cf6;
    transform: translateY(-1px);
}

.copy-btn:hover {
    background: rgba(16, 185, 129, 0.3);
    border-color: #10b981;
}

.download-btn:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: #3b82f6;
}

.share-btn:hover {
    background: rgba(139, 92, 246, 0.3);
    border-color: #8b5cf6;
}

/* Usage Stats */
.usage-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 1rem;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 10px;
    margin: 1rem;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
    min-width: 120px;
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: #94a3b8;
    margin-bottom: 0.25rem;
}

.stat-value {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: #8b5cf6;
}

/* Mobile Responsiveness */
@media (max-width: 767px) {
    .ai-prompt-container {
        min-height: auto;
        margin: 0 -15px;
        border-radius: 0;
    }

    .ai-prompt-header {
        padding: 1.5rem 1rem;
    }

    .ai-prompt-main {
        padding: 1rem;
        gap: 1rem;
    }

    .panel-content {
        padding: 1rem;
    }

    .field-group {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .upload-zone {
        padding: 1.5rem;
    }

    .upload-icon {
        font-size: 2rem;
    }

    .checkbox-grid {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        grid-template-columns: 1fr;
    }

    .usage-stats {
        flex-direction: column;
        gap: 1rem;
    }
}

/* WordPress Content Area Compatibility */
.entry-content .ai-prompt-container {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* Additional mobile fixes for WordPress */
@media (max-width: 544px) {
    .ai-prompt-container {
        margin: 0 -20px;
    }
}

/* Loading States */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading .field-group {
    position: relative;
}

.loading .field-group::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    border-radius: 12px;
    z-index: 10;
}

/* Success/Error States */
.success-message,
.error-message {
    position: fixed;
    top: 20px;
    right: 20px;
    left: auto;
    z-index: 9999;
    width: auto;
    min-width: 200px;
    max-width: 350px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.success-message {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid #10b981;
    color: #047857;
}

.error-message {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid #ef4444;
    color: #b91c1c;
}

/* Platform Badge */
.platform-badge {
    display: inline-block;
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid #8b5cf6;
    color: #a78bfa;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Result meta styling */
.result-meta {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.result-meta small {
    color: #94a3b8;
    font-size: 0.8rem;
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* WordPress theme override - ensure our styles take precedence */
.ai-prompt-container select,
.ai-prompt-container .premium-select,
.ai-prompt-container .platform-select {
    background: #1e293b !important;
    color: #f8fafc !important;
    border: 2px solid rgba(148, 163, 184, 0.4) !important;
    font-size: 0.9rem !important;
    padding: 0.75rem !important;
    border-radius: 8px !important;
    height: auto !important;
    line-height: normal !important;
}

/* Fix for WordPress theme conflicts */
.ai-prompt-container {
    font-size: 14px !important;
}

/* Ensure proper stacking order for dropdowns */
.field-group {
    z-index: auto;
}

.premium-selection {
    z-index: 10;
}

/* Better dropdown visibility on focus */
select:focus {
    background: #1e293b !important;
    color: #f8fafc !important;
    border-color: #8b5cf6 !important;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.3) !important;
}