/**
 * SeriesWire AI Prompt Generator Pro
 * Version: 3.0.0 - Dual Mode (Text + Image)
 * Fully responsive, modern design
 */

/* ============================================
   GLOBAL STYLES & RESET
   ============================================ */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.sw-prompt-generator {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #1a1a2e;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   CONTAINER & LAYOUT
   ============================================ */

.sw-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 60px 20px;
    min-height: 100vh;
    background: linear-gradient(135deg, #e97b33 30%, #01266f 100%);
}

/* ============================================
   HEADER SECTION
   ============================================ */

.sw-header {
    text-align: center;
    margin-bottom: 50px;
    animation: fadeInDown 0.6s ease-out;
}

.sw-header h2 {
    font-size: 42px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.sw-header h2 .sw-emoji-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.sw-header p {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.95);
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ============================================
   MAIN CARD - THE WHITE BOX
   ============================================ */

.sw-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 50px 45px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    animation: fadeInUp 0.6s ease-out;
}

/* ============================================
   FORM SECTIONS
   ============================================ */

.sw-form-section {
    margin-bottom: 35px;
}

.sw-form-section:last-child {
    margin-bottom: 0;
}

.sw-section-title {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sw-section-title .sw-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
}

.sw-section-description {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* ============================================
   FORM CONTROLS
   ============================================ */

.sw-form-group {
    margin-bottom: 25px;
}

.sw-form-group label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 10px;
}

.sw-form-group label .sw-required {
    color: #ef4444;
    margin-left: 3px;
}

.sw-form-control {
    width: 100%;
    padding: 5px 18px;
    font-size: 15px;
    color: #1e293b;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.sw-form-control:focus {
    outline: none;
    border-color: #667eea;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.sw-form-control:hover {
    border-color: #cbd5e1;
}

.sw-form-control.sw-error {
    border-color: #ef4444;
    background: #fef2f2;
}

textarea.sw-form-control {
    min-height: 140px;
    resize: vertical;
    line-height: 1.6;
}

select.sw-form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23334155' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    padding-right: 45px;
}

/* Character Counter */
.sw-char-counter {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 13px;
    color: #64748b;
}

.sw-char-current {
    font-weight: 600;
    color: #667eea;
}

/* Helper Text */
.sw-helper-text {
    font-size: 13px;
    color: #64748b;
    margin-top: 8px;
    line-height: 1.5;
}

.sw-tone-description,
.sw-role-description,
.sw-format-description,
.sw-humanization-description {
    font-size: 13px;
    color: #667eea;
    margin-top: 8px;
    font-style: italic;
    min-height: 20px;
}

/* ============================================
   ERROR MESSAGES
   ============================================ */

.sw-error-message {
    display: none;
    font-size: 13px;
    color: #ef4444;
    margin-top: 8px;
    font-weight: 500;
}

.sw-error-message.sw-visible {
    display: block;
    animation: shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ============================================
   HUMANIZATION INFO BOX
   ============================================ */

.sw-humanization-info {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    border: 2px solid #667eea;
    border-radius: 12px;
    padding: 20px;
    margin-top: 15px;
}

.sw-humanization-info p {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 12px;
}

.sw-humanization-info ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sw-humanization-info li {
    font-size: 14px;
    color: #475569;
    padding: 6px 0;
    line-height: 1.6;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

/* ============================================
   COLLAPSIBLE SECTIONS
   ============================================ */

.sw-collapsible .sw-section-title {
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 12px;
    margin: -12px;
    border-radius: 8px;
}

.sw-collapsible .sw-section-title:hover {
    background: #f8fafc;
}

.sw-collapsible-trigger {
    position: relative;
}

.sw-toggle-icon {
    position: absolute;
    right: 12px;
    font-size: 14px;
    color: #667eea;
    transition: transform 0.3s ease;
}

.sw-collapsible-content {
    padding: 20px 0 0 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

/* ============================================
   BUTTONS
   ============================================ */

.sw-button-group {
    display: flex;
    gap: 15px;
    margin-top: 35px;
}

.sw-btn {
    flex: 1;
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.sw-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.4);
}

.sw-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.5);
}

.sw-btn-primary:active {
    transform: translateY(0);
}

.sw-btn-secondary {
    background: #f1f5f9;
    color: #334155;
    border: 2px solid #e2e8f0;
}

.sw-btn-secondary:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.sw-btn-success {
    background: #10b981;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.sw-btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.5);
}

.sw-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.sw-btn-small {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: initial;
}

/* ============================================
   OUTPUT SECTION
   ============================================ */

.sw-output-section {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 2px solid #f1f5f9;
    animation: fadeInUp 0.5s ease-out;
}

.sw-output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.sw-output-header h3 {
    font-size: 22px;
    font-weight: 600;
    color: #1a1a2e;
}

.sw-output-actions {
    display: flex;
    gap: 10px;
}

.sw-output-box {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 25px;
    min-height: 300px;
    position: relative;
}

.sw-output-textarea {
    width: 100%;
    height: 400px;
    background: transparent;
    border: none;
    font-size: 15px;
    color: #1e293b;
    line-height: 1.8;
    resize: vertical;
    font-family: 'Monaco', 'Courier New', monospace;
}

.sw-output-textarea:focus {
    outline: none;
}

/* ============================================
   METADATA SECTION
   ============================================ */

.sw-metadata {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid #e2e8f0;
}

.sw-prompt-analysis {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(16, 185, 129, 0.02) 100%);
    border-left: 4px solid #10b981;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.sw-prompt-analysis h4 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 15px;
}

.sw-prompt-analysis ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sw-prompt-analysis li {
    font-size: 14px;
    color: #475569;
    padding: 6px 0;
    line-height: 1.6;
}

.sw-prompt-analysis li strong {
    color: #10b981;
    margin-right: 8px;
}

.sw-meta-info {
    background: #f8fafc;
    border-left: 4px solid #667eea;
    padding: 18px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.sw-meta-tip {
    font-size: 14px;
    color: #475569;
    margin: 0;
    line-height: 1.7;
}

.sw-meta-tip strong {
    color: #1e293b;
    font-weight: 600;
}

/* ============================================
   LOADING OVERLAY
   ============================================ */

.sw-loading {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.sw-loading-content {
    text-align: center;
    color: #ffffff;
}

.sw-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

.sw-loading-content p {
    font-size: 17px;
    font-weight: 500;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ============================================
   MODE OPTIONS VISIBILITY
   ============================================ */

.sw-mode-options {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .sw-container {
        padding: 40px 15px;
    }
    
    .sw-header h2 {
        font-size: 32px;
        flex-direction: column;
        gap: 10px;
    }
    
    .sw-header h2 .sw-emoji-icon {
        width: 45px;
        height: 45px;
    }
    
    .sw-header p {
        font-size: 16px;
    }
    
    .sw-card {
        padding: 35px 25px;
        border-radius: 16px;
    }
    
    .sw-section-title {
        font-size: 18px;
    }
    
    .sw-button-group {
        flex-direction: column;
    }
    
    .sw-btn {
        width: 100%;
    }
    
    .sw-output-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .sw-output-actions {
        width: 100%;
    }
    
    .sw-btn-small {
        flex: 1;
    }
    
    .sw-humanization-info {
        padding: 15px;
    }
    
    .sw-humanization-info li {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .sw-header h2 {
        font-size: 26px;
    }
    
    .sw-card {
        padding: 25px 20px;
    }
    
    .sw-section-title {
        font-size: 16px;
    }
    
    .sw-form-control {
        font-size: 14px;
        padding: 5px 15px;
    }
    
    .sw-output-textarea {
        height: 350px;
        font-size: 14px;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.sw-form-control:focus-visible,
.sw-btn:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.sw-hidden {
    display: none !important;
}

.sw-text-center {
    text-align: center;
}

.sw-mt-10 {
    margin-top: 10px;
}

.sw-mt-20 {
    margin-top: 20px;
}

.sw-mb-20 {
    margin-bottom: 20px;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .sw-container {
        background: white;
        padding: 20px;
    }
    
    .sw-card {
        box-shadow: none;
        border: 1px solid #e2e8f0;
    }
    
    .sw-button-group,
    .sw-loading {
        display: none !important;
    }
}
