/*
 *   Copyright (c) 2025 BitsHost
 *   All rights reserved.

 *   Permission is hereby granted, free of charge, to any person obtaining a copy
 *   of this software and associated documentation files (the "Software"), to deal
 *   in the Software without restriction, including without limitation the rights
 *   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 *   copies of the Software, and to permit persons to whom the Software is
 *   furnished to do so, subject to the following conditions:

 *   The above copyright notice and this permission notice shall be included in all
 *   copies or substantial portions of the Software.

 *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 *   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 *   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 *   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 *   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 *   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 *   SOFTWARE.
 */


/**
 * CM Auto Alt Text - Frontend Styles
 * 
 * @package CM_Auto_Alt_Text
 * @version 1.4.0
 */

/* ==========================================================================
   Generate Button Styles
   ========================================================================== */

.auto-alt-text-generate {
    background: linear-gradient(135deg, #00a0d2 0%, #0073aa 100%);
    border: none;
    color: #fff;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    text-shadow: 0 1px 0 rgba(0,0,0,.1);
    transition: all 0.2s ease;
    display: inline-block;
    text-decoration: none;
    line-height: 1.4;
    min-height: 30px;
    box-shadow: 0 1px 2px rgba(0,0,0,.1);
}

.auto-alt-text-generate:hover {
    background: linear-gradient(135deg, #007fb1 0%, #005a87 100%);
    box-shadow: 0 2px 4px rgba(0,0,0,.15);
    transform: translateY(-1px);
}

.auto-alt-text-generate:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,0,0,.1);
}

.auto-alt-text-generate:disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.auto-alt-text-generate .spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin-right: 5px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.auto-alt-text-generate .provider-info {
    font-size: 11px;
    opacity: 0.8;
    font-weight: normal;
}

/* ==========================================================================
   Provider Selection Styles
   ========================================================================== */

.auto-alt-text-provider-select {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 5px 8px;
    font-size: 13px;
    color: #32373c;
    min-width: 150px;
    margin-right: 10px;
    vertical-align: middle;
}

.auto-alt-text-provider-select:focus {
    border-color: #007fb1;
    outline: none;
    box-shadow: 0 0 0 1px #007fb1;
}

.auto-alt-text-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

/* ==========================================================================
   Media Modal Specific Styles
   ========================================================================== */

.media-modal .auto-alt-text-controls {
    margin: 15px 0;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
}

.media-modal .auto-alt-text-section-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: #23282d;
    font-size: 14px;
}

.media-modal .auto-alt-text-description {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
    line-height: 1.4;
}

/* ==========================================================================
   Cost Display Styles
   ========================================================================== */

.cm-alt-text-cost {
    position: fixed;
    top: 32px;
    right: 20px;
    background: #23282d;
    color: #fff;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    z-index: 99999;
    box-shadow: 0 2px 5px rgba(0,0,0,.2);
    transition: opacity 0.3s ease;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media screen and (max-width: 782px) {
    .auto-alt-text-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .auto-alt-text-provider-select {
        margin-right: 0;
        margin-bottom: 10px;
        width: 100%;
    }
    
    .auto-alt-text-generate {
        width: 100%;
        text-align: center;
        padding: 10px 16px;
    }
    
    .cm-alt-text-cost {
        top: 46px;
        right: 10px;
        font-size: 11px;
    }
}

/* ==========================================================================
   Media Library Grid View
   ========================================================================== */

.attachment .auto-alt-text-controls {
    position: absolute;
    bottom: 5px;
    left: 5px;
    right: 5px;
    background: rgba(0,0,0,.7);
    padding: 5px;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.attachment:hover .auto-alt-text-controls {
    opacity: 1;
}

.attachment .auto-alt-text-generate {
    font-size: 11px;
    padding: 4px 8px;
    min-height: auto;
}

.attachment .auto-alt-text-provider-select {
    font-size: 11px;
    padding: 2px 4px;
    min-width: 80px;
    margin-right: 5px;
}

/* ==========================================================================
   WordPress Admin Color Schemes
   ========================================================================== */

/* Fresh (Default) */
.admin-color-fresh .auto-alt-text-generate {
    background: linear-gradient(135deg, #00a0d2 0%, #0073aa 100%);
}

.admin-color-fresh .auto-alt-text-generate:hover {
    background: linear-gradient(135deg, #007fb1 0%, #005a87 100%);
}

/* Light */
.admin-color-light .auto-alt-text-generate {
    background: linear-gradient(135deg, #04a4cc 0%, #032e56 100%);
}

.admin-color-light .auto-alt-text-generate:hover {
    background: linear-gradient(135deg, #037597 0%, #021c3a 100%);
}

/* Blue */
.admin-color-blue .auto-alt-text-generate {
    background: linear-gradient(135deg, #e1a948 0%, #d29d3d 100%);
}

.admin-color-blue .auto-alt-text-generate:hover {
    background: linear-gradient(135deg, #d49c43 0%, #c58d2e 100%);
}

/* Coffee */
.admin-color-coffee .auto-alt-text-generate {
    background: linear-gradient(135deg, #c7a589 0%, #a58365 100%);
}

.admin-color-coffee .auto-alt-text-generate:hover {
    background: linear-gradient(135deg, #b99575 0%, #9a785e 100%);
}

/* Ectoplasm */
.admin-color-ectoplasm .auto-alt-text-generate {
    background: linear-gradient(135deg, #a3b745 0%, #8eb03a 100%);
}

.admin-color-ectoplasm .auto-alt-text-generate:hover {
    background: linear-gradient(135deg, #97a83f 0%, #829b34 100%);
}

/* Midnight */
.admin-color-midnight .auto-alt-text-generate {
    background: linear-gradient(135deg, #e14d43 0%, #dd382d 100%);
}

.admin-color-midnight .auto-alt-text-generate:hover {
    background: linear-gradient(135deg, #dd453c 0%, #d13529 100%);
}

/* Ocean */
.admin-color-ocean .auto-alt-text-generate {
    background: linear-gradient(135deg, #a3b9cc 0%, #8bb1c6 100%);
}

.admin-color-ocean .auto-alt-text-generate:hover {
    background: linear-gradient(135deg, #96abc2 0%, #7da6be 100%);
}

/* Sunrise */
.admin-color-sunrise .auto-alt-text-generate {
    background: linear-gradient(135deg, #dd823b 0%, #d1732a 100%);
}

.admin-color-sunrise .auto-alt-text-generate:hover {
    background: linear-gradient(135deg, #d17a35 0%, #c66e26 100%);
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .auto-alt-text-controls {
        background: #2c3338;
        border-color: #3c434a;
    }
    
    .auto-alt-text-provider-select {
        background: #32373c;
        border-color: #3c434a;
        color: #ffffff;
    }
    
    .auto-alt-text-section-title {
        color: #ffffff;
    }
    
    .auto-alt-text-description {
        color: #c3c4c7;
    }
}

/* ==========================================================================
   High Contrast Mode
   ========================================================================== */

@media (prefers-contrast: high) {
    .auto-alt-text-generate {
        background: #000;
        border: 2px solid #fff;
        font-weight: bold;
    }
    
    .auto-alt-text-generate:hover {
        background: #333;
    }
    
    .auto-alt-text-provider-select {
        border: 2px solid #000;
        font-weight: bold;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .auto-alt-text-controls,
    .cm-alt-text-cost {
        display: none;
    }
}

/* ==========================================================================
   Animation Utilities
   ========================================================================== */

.cm-alt-text-fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.cm-alt-text-shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ==========================================================================
   Focus Management
   ========================================================================== */

.auto-alt-text-generate:focus,
.auto-alt-text-provider-select:focus {
    outline: 2px solid #007fb1;
    outline-offset: 2px;
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.auto-alt-text-loading {
    position: relative;
    overflow: hidden;
}

.auto-alt-text-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* ==========================================================================
   Error States
   ========================================================================== */

.auto-alt-text-error {
    background: #dc3232;
    border-color: #dc3232;
}

.auto-alt-text-error:hover {
    background: #c32d2d;
}

.auto-alt-text-success {
    background: #46b450;
    border-color: #46b450;
}

.auto-alt-text-success:hover {
    background: #3fa147;
}