/**
 * Modern Public UI for FlyerForge Plugin
 * Design inspired by contemporary web applications
 */

:root {
    --ff-primary: #4A90E2;
    --ff-primary-hover: #357ABD;
    --ff-secondary: #F8F9FA;
    --ff-text-dark: #212529;
    --ff-text-light: #6C757D;
    --ff-border: #DEE2E6;
    --ff-success: #28A745;
    --ff-error: #DC3545;
    --ff-warning: #FFC107;
    --ff-radius: 6px;
    --ff-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    --ff-shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.12);
    --ff-bg-main: #FFFFFF;
    --ff-input-bg: #FFFFFF;
    --ff-input-text: #212529;
    --ff-input-placeholder: #ADB5BD;
}

/* Main Container */
.flyerforge-generator {
    max-width: 900px;
    margin: 40px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    padding: 0 20px;
}

/* Form Container - Card Style */
.flyerforge-form-container {
    background: var(--ff-bg-main);
    padding: 40px;
    border-radius: var(--ff-radius);
    box-shadow: var(--ff-shadow-lg);
    border: 1px solid var(--ff-border);
}

/* Header */
.flyerforge-form-container h3 {
    margin: 0 0 10px 0;
    color: var(--ff-text-dark);
    font-size: 28px;
    font-weight: 700;
    text-align: center;
}

.flyerforge-form-subtitle {
    text-align: center;
    color: var(--ff-text-light);
    font-size: 15px;
    margin-bottom: 35px;
}

/* Form Fields */
.flyerforge-field {
    margin-bottom: 28px;
}

.flyerforge-field label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--ff-text-dark);
    font-size: 14px;
    letter-spacing: 0.3px;
}

.flyerforge-field label .required {
    color: var(--ff-error);
    margin-left: 3px;
}

/* Text Inputs */
.flyerforge-field input[type="text"],
.flyerforge-field textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius);
    font-size: 15px;
    transition: all 0.2s ease;
    box-sizing: border-box;
    background: var(--ff-input-bg);
    color: var(--ff-input-text);
}

.flyerforge-field input[type="text"]:focus,
.flyerforge-field textarea:focus {
    outline: none;
    border-color: var(--ff-primary);
    background: var(--ff-input-bg);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.15);
}

.flyerforge-field input[type="text"]::placeholder,
.flyerforge-field textarea::placeholder {
    color: var(--ff-input-placeholder);
}

.flyerforge-field textarea {
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}

/* File Upload - Modern Style */
.flyerforge-file-upload {
    position: relative;
}

.flyerforge-field input[type="file"] {
    display: none;
}

.flyerforge-upload-area {
    border: 2px dashed var(--ff-border);
    border-radius: var(--ff-radius);
    padding: 35px 20px;
    text-align: center;
    background: var(--ff-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.flyerforge-upload-area:hover {
    border-color: var(--ff-primary);
    background: rgba(74, 144, 226, 0.05);
}

.flyerforge-upload-area.has-file {
    border-color: var(--ff-success);
    background: rgba(40, 167, 69, 0.05);
}

.flyerforge-upload-icon {
    width: 50px;
    height: 50px;
    margin: 0 auto 12px;
    background: var(--ff-bg-main);
    border-radius: var(--ff-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--ff-shadow);
}

.flyerforge-upload-icon svg {
    width: 28px;
    height: 28px;
    color: var(--ff-primary);
}

.flyerforge-upload-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--ff-text-dark);
    margin-bottom: 5px;
}

.flyerforge-upload-hint {
    font-size: 13px;
    color: var(--ff-text-light);
}

.flyerforge-file-name {
    margin-top: 12px;
    padding: 8px 14px;
    background: var(--ff-bg-main);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius);
    font-size: 14px;
    color: var(--ff-text-dark);
    display: inline-block;
}

/* Image Preview */
.flyerforge-image-preview {
    position: relative;
    width: 100%;
    max-width: 300px;
    margin: 0 auto 15px;
}

.flyerforge-image-preview img {
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: contain;
    border-radius: var(--ff-radius);
    box-shadow: var(--ff-shadow);
    background: var(--ff-bg-main);
}

.flyerforge-remove-preview {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 32px;
    height: 32px;
    background: var(--ff-error);
    color: white;
    border: 2px solid var(--ff-bg-main);
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    font-weight: bold;
}

.flyerforge-remove-preview:hover {
    background: #C82333;
    transform: scale(1.1);
}

.flyerforge-upload-area.has-file {
    padding: 20px;
}

/* Help Text */
.flyerforge-help {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    color: var(--ff-text-light);
}

/* Character Counter */
.flyerforge-char-counter {
    text-align: right;
    font-size: 12px;
    color: var(--ff-text-light);
    margin-top: 6px;
}

.flyerforge-char-counter.warning {
    color: var(--ff-warning);
}

.flyerforge-char-counter.error {
    color: var(--ff-error);
}

/* Submit Button */
.flyerforge-submit-button {
    background: var(--ff-primary);
    color: white;
    border: none;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--ff-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    box-shadow: var(--ff-shadow);
    margin-top: 10px;
}

.flyerforge-submit-button:hover {
    background: var(--ff-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(74, 144, 226, 0.3);
}

.flyerforge-submit-button:active {
    transform: translateY(0);
}

.flyerforge-submit-button:disabled {
    background: #ADB5BD;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Loading State */
.flyerforge-loading {
    text-align: center;
    padding: 50px 20px;
    background: var(--ff-bg-main);
    border-radius: var(--ff-radius);
    box-shadow: var(--ff-shadow);
    border: 1px solid var(--ff-border);
}

.flyerforge-spinner {
    width: 45px;
    height: 45px;
    margin: 0 auto 20px;
    border: 3px solid var(--ff-secondary);
    border-top: 3px solid var(--ff-primary);
    border-radius: 50%;
    animation: flyerforge-spin 0.8s linear infinite;
}

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

.flyerforge-loading p {
    color: var(--ff-text-dark);
    font-size: 16px;
    font-weight: 500;
}

/* Result Card */
.flyerforge-result {
    background: var(--ff-bg-main);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius);
    padding: 35px;
    margin-top: 25px;
    box-shadow: var(--ff-shadow-lg);
}

.flyerforge-result h4 {
    margin: 0 0 25px 0;
    color: var(--ff-text-dark);
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.flyerforge-result h4::before {
    content: "✓";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--ff-success);
    color: white;
    border-radius: 50%;
    font-size: 18px;
}

.flyerforge-result-image {
    text-align: center;
    margin: 25px 0;
    background: var(--ff-secondary);
    padding: 20px;
    border-radius: var(--ff-radius);
}

.flyerforge-result-image img {
    max-width: 100%;
    height: auto;
    border-radius: var(--ff-radius);
    box-shadow: var(--ff-shadow);
}

/* Action Buttons */
.flyerforge-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 25px;
}

.flyerforge-action-button {
    background: var(--ff-primary);
    color: white;
    text-decoration: none;
    padding: 12px 22px;
    border-radius: var(--ff-radius);
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    text-align: center;
}

.flyerforge-action-button:hover {
    background: var(--ff-primary-hover);
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--ff-shadow);
}

.flyerforge-action-button.secondary {
    background: var(--ff-bg-main);
    color: var(--ff-text-dark);
    border: 1px solid var(--ff-border);
}

.flyerforge-action-button.secondary:hover {
    background: var(--ff-secondary);
    border-color: var(--ff-primary);
    color: var(--ff-primary);
}

/* Sharing Section */
.flyerforge-sharing-links {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid var(--ff-border);
}

.flyerforge-sharing-links h5 {
    margin: 0 0 18px 0;
    color: var(--ff-text-dark);
    font-size: 16px;
    font-weight: 600;
}

.flyerforge-sharing-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.flyerforge-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    text-decoration: none;
    border-radius: var(--ff-radius);
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    color: white;
}

.flyerforge-share-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--ff-shadow);
    color: white;
    text-decoration: none;
}

.flyerforge-share-btn.whatsapp {
    background: #25D366;
}

.flyerforge-share-btn.twitter {
    background: #1DA1F2;
}

.flyerforge-share-btn.facebook {
    background: #4267B2;
}

.flyerforge-share-btn.linkedin {
    background: #0077B5;
}

.flyerforge-share-btn.email {
    background: #6C757D;
}

.flyerforge-share-btn.copy-link {
    background: var(--ff-primary);
}

.flyerforge-share-btn.copy-link.copied {
    background: var(--ff-success);
}

/* Error Messages */
.flyerforge-error {
    background: #FFF5F5;
    border: 1px solid #F5C2C7;
    color: #842029;
    padding: 14px 16px;
    border-radius: var(--ff-radius);
    margin-top: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.flyerforge-error::before {
    content: "⚠";
    font-size: 18px;
    flex-shrink: 0;
}

/* Template Preview */
.flyerforge-template-preview {
    margin-top: 40px;
    padding: 30px;
    background: var(--ff-secondary);
    border-radius: var(--ff-radius);
    text-align: center;
}

.flyerforge-template-preview h4 {
    margin: 0 0 20px 0;
    color: var(--ff-text-dark);
    font-size: 18px;
    font-weight: 600;
}

.flyerforge-template-preview img {
    border-radius: var(--ff-radius);
    box-shadow: var(--ff-shadow-lg);
    max-width: 100%;
    height: auto;
}

/* Progress Steps (Optional Enhancement) */
.flyerforge-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    position: relative;
}

.flyerforge-steps::before {
    content: "";
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--ff-border);
    z-index: 0;
}

.flyerforge-step {
    flex: 1;
    text-align: center;
    position: relative;
    z-index: 1;
}

.flyerforge-step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ff-bg-main);
    border: 2px solid var(--ff-border);
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--ff-text-light);
}

.flyerforge-step.active .flyerforge-step-circle {
    background: var(--ff-primary);
    border-color: var(--ff-primary);
    color: white;
}

.flyerforge-step.completed .flyerforge-step-circle {
    background: var(--ff-success);
    border-color: var(--ff-success);
    color: white;
}

.flyerforge-step-label {
    font-size: 13px;
    color: var(--ff-text-light);
    font-weight: 500;
}

.flyerforge-step.active .flyerforge-step-label {
    color: var(--ff-primary);
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .flyerforge-generator {
        margin: 20px auto;
        padding: 0 15px;
    }
    
    .flyerforge-form-container {
        padding: 25px 20px;
    }
    
    .flyerforge-form-container h3 {
        font-size: 24px;
    }
    
    .flyerforge-actions {
        grid-template-columns: 1fr;
    }
    
    .flyerforge-sharing-buttons {
        flex-direction: column;
    }
    
    .flyerforge-share-btn {
        justify-content: center;
    }
    
    .flyerforge-steps {
        flex-direction: column;
        gap: 15px;
    }
    
    .flyerforge-steps::before {
        display: none;
    }
}

/* Accessibility */
.flyerforge-field input:focus,
.flyerforge-field textarea:focus,
.flyerforge-submit-button:focus,
.flyerforge-action-button:focus,
.flyerforge-share-btn:focus {
    outline: 3px solid rgba(91, 127, 255, 0.5);
    outline-offset: 2px;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --ff-primary: #5B9FFF;
        --ff-primary-hover: #4A8FEE;
        --ff-secondary: #2A2E35;
        --ff-text-dark: #E8EAED;
        --ff-text-light: #9AA0A6;
        --ff-border: #3C4043;
        --ff-bg-main: #1F2125;
        --ff-input-bg: #2A2E35;
        --ff-input-text: #E8EAED;
        --ff-input-placeholder: #80868B;
        --ff-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
        --ff-shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.4);
    }
    
    .flyerforge-upload-icon {
        background: var(--ff-secondary);
    }
    
    .flyerforge-error {
        background: #3A1F1F;
        border-color: #8B3A3A;
        color: #FFB4B4;
    }
}

/* Animation for Success State */
@keyframes flyerforge-success {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.flyerforge-result {
    animation: flyerforge-success 0.4s ease-out;
}
