/**
 * AI Image Generator Pro - Stylesheet
 * @package AI_Image_Generator_Pro
 * @author Maisara Hammad
 * @link https://mhdevs.com
 */

/* =============================
   Generator Wrapper
   ============================= */

.aigbp-generator-wrapper {
    max-width: 800px;
    margin: 20px auto;
    padding: 25px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.aigbp-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.aigbp-credits-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.aigbp-credits-total {
    font-size: 18px;
}

.aigbp-credits-total .aigbp-label {
    color: #666;
    font-weight: normal;
    margin-right: 5px;
}

.aigbp-credits-total .aigbp-count {
    font-size: 28px;
    color: #2271b1;
    font-weight: 700;
}

.aigbp-credits-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 14px;
}

.aigbp-credit-item {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    background: #f7f7f7;
    border-radius: 20px;
    color: #555;
}

.aigbp-credit-item strong {
    color: #2271b1;
    margin: 0 3px;
}

.aigbp-remaining-info {
    font-size: 16px;
    color: #555;
    margin: 0;
}

.aigbp-count {
    color: #2271b1;
    font-size: 20px;
}

.aigbp-limit {
    color: #666;
}

/* =============================
   Dynamic Provider Fields
   ============================= */

.aigbp-provider-field {
    transition: opacity 0.3s ease, max-height 0.3s ease;
}

.aigbp-provider-field[style*="display: none"] {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
}

/* =============================
   Generation Tabs
   ============================= */

.aigbp-generation-tabs {
    margin-bottom: 20px;
}

.aigbp-tabs-nav {
    display: flex;
    gap: 5px;
    border-bottom: 2px solid #ddd;
    margin-bottom: 20px;
}

.aigbp-tab-btn {
    padding: 12px 20px;
    background: #f5f5f5;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #666;
    transition: all 0.3s ease;
    border-radius: 5px 5px 0 0;
}

.aigbp-tab-btn:hover {
    background: #e8e8e8;
    color: #333;
}

.aigbp-tab-btn.active {
    background: #fff;
    color: #2271b1;
    border-bottom-color: #2271b1;
}

.aigbp-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.aigbp-tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =============================
   Image Upload Section
   ============================= */

.aigbp-image-upload-section {
    margin-bottom: 20px;
}

.aigbp-upload-options {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.aigbp-upload-btn,
.aigbp-select-gallery-btn {
    padding: 10px 20px !important;
    font-size: 14px !important;
}

.aigbp-image-preview {
    padding: 15px;
    background: #f9f9f9;
    border: 2px dashed #ddd;
    border-radius: 8px;
    text-align: center;
}

.aigbp-image-preview img {
    display: block;
    margin: 0 auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.aigbp-remove-image-btn,
.aigbp-remove-upscale-btn {
    margin-top: 10px !important;
    font-size: 13px !important;
    padding: 8px 15px !important;
}

/* =============================
   Model Selector
   ============================= */

.aigbp-model-selector {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.aigbp-select {
    width: 100%;
    max-width: 400px;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.aigbp-select:focus {
    outline: none;
    border-color: #2271b1;
}

.aigbp-help-text {
    font-size: 13px;
    color: #666;
    margin-top: 5px;
}

/* =============================
   Form Elements
   ============================= */

.aigbp-label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
    font-size: 15px;
}

.aigbp-textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.3s;
}

.aigbp-textarea:focus {
    outline: none;
    border-color: #2271b1;
}

.aigbp-actions {
    margin-top: 15px;
}

.aigbp-btn {
    padding: 12px 30px !important;
    font-size: 16px !important;
    border-radius: 6px !important;
    cursor: pointer;
}

.aigbp-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* =============================
   Loader
   ============================= */

.aigbp-loader {
    margin-top: 20px;
    padding: 15px;
    background: #f0f9ff;
    border: 1px solid #b3d9ff;
    border-radius: 6px;
    text-align: center;
}

.aigbp-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2271b1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

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

.aigbp-loader-text {
    color: #0066a1;
    font-size: 14px;
}

/* =============================
   Result & Messages
   ============================= */

.aigbp-result {
    margin-top: 25px;
}

.aigbp-result img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.aigbp-notice {
    padding: 15px 20px;
    margin: 20px 0;
    border-left: 4px solid;
    border-radius: 4px;
}

.aigbp-notice-error {
    background: #fff0f0;
    border-color: #dc3232;
    color: #a00;
}

.aigbp-notice-warning {
    background: #fff8e5;
    border-color: #f0ad4e;
    color: #856404;
}

.aigbp-notice-info {
    background: #e8f4f8;
    border-color: #00a0d2;
    color: #00566b;
}

.aigbp-notice p {
    margin: 0;
}

.aigbp-error-message {
    color: #dc3232;
    padding: 12px;
    background: #fff0f0;
    border: 1px solid #dc3232;
    border-radius: 4px;
    margin-top: 15px;
}

.aigbp-success-message {
    color: #46b450;
    padding: 12px;
    background: #f0fff4;
    border: 1px solid #46b450;
    border-radius: 4px;
    margin-top: 15px;
}

/* =============================
   Image Actions
   ============================= */

.aigbp-image-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.aigbp-download-btn,
.aigbp-view-btn {
    display: inline-block;
    padding: 10px 20px !important;
    text-decoration: none !important;
    border-radius: 5px !important;
    font-size: 14px !important;
    transition: all 0.3s ease;
    text-align: center;
}

.aigbp-download-btn {
    background: #2271b1 !important;
    color: #fff !important;
    border: 2px solid #2271b1 !important;
}

.aigbp-download-btn:hover {
    background: #135e96 !important;
    border-color: #135e96 !important;
    color: #fff !important;
}

.aigbp-view-btn {
    background: #fff !important;
    color: #2271b1 !important;
    border: 2px solid #2271b1 !important;
}

.aigbp-view-btn:hover {
    background: #f0f9ff !important;
    color: #135e96 !important;
}

/* =============================
   Gallery Styles
   ============================= */

.aigbp-gallery-wrapper {
    max-width: 1200px;
    margin: 30px auto;
    padding: 20px;
}

.aigbp-gallery-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid #2271b1;
}

.aigbp-gallery-header h2 {
    color: #333;
    font-size: 28px;
    margin-bottom: 10px;
}

.aigbp-gallery-count {
    color: #666;
    font-size: 16px;
    margin: 0;
}

.aigbp-gallery-count strong {
    color: #2271b1;
}

.aigbp-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.aigbp-gallery-item {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.aigbp-gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.aigbp-gallery-image-link {
    display: block;
    position: relative;
    overflow: hidden;
}

.aigbp-gallery-item img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.aigbp-gallery-image-link:hover img {
    transform: scale(1.05);
}

.aigbp-gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.aigbp-gallery-image-link:hover .aigbp-gallery-overlay {
    opacity: 1;
}

.aigbp-gallery-view-icon {
    font-size: 40px;
    color: #fff;
}

.aigbp-gallery-item-info {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9f9f9;
    border-top: 1px solid #eee;
}

.aigbp-gallery-date {
    font-size: 13px;
    color: #666;
}

.aigbp-gallery-download {
    font-size: 13px;
    color: #2271b1;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.aigbp-gallery-download:hover {
    color: #135e96;
    text-decoration: underline;
}

/* =============================
   Responsive Design
   ============================= */

@media (max-width: 768px) {
    .aigbp-tabs-nav {
        flex-direction: column;
        gap: 5px;
    }
    
    .aigbp-tab-btn {
        width: 100%;
        text-align: center;
        border-radius: 5px;
        border-bottom: none;
        border-left: 3px solid transparent;
    }
    
    .aigbp-tab-btn.active {
        border-left-color: #2271b1;
        border-bottom: none;
    }
    
    .aigbp-upload-options {
        flex-direction: column;
    }
    
    .aigbp-upload-btn,
    .aigbp-select-gallery-btn {
        width: 100%;
    }
    
    .aigbp-gallery {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }

    .aigbp-gallery-item img {
        height: 200px;
    }

    .aigbp-generator-wrapper {
        padding: 15px;
        margin: 10px;
    }

    .aigbp-btn {
        width: 100%;
        padding: 15px !important;
    }

    .aigbp-image-actions {
        flex-direction: column;
    }

    .aigbp-download-btn,
    .aigbp-view-btn {
        width: 100%;
    }
}
