/**
 * Bear Studio AI - Frontend Styles
 * Archivo: assets/css/bear-ai-frontend.css
 */

/* ============================================================
   OVERLAY Y MODAL
   ============================================================ */

.bear-ai-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: bearAiFadeIn 0.2s ease;
}

@keyframes bearAiFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.bear-ai-modal {
    background: linear-gradient(145deg, #1a1a2e, #16213e);
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 
        0 0 0 1px rgba(0, 85, 253, 0.3),
        0 25px 80px rgba(0, 0, 0, 0.7),
        0 0 60px rgba(0, 85, 253, 0.1);
    animation: bearAiSlideUp 0.3s ease;
}

@keyframes bearAiSlideUp {
    from { 
        transform: translateY(30px); 
        opacity: 0; 
    }
    to { 
        transform: translateY(0); 
        opacity: 1; 
    }
}

/* ============================================================
   HEADER
   ============================================================ */

.bear-ai-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(90deg, rgba(0, 85, 253, 0.1), rgba(255, 0, 170, 0.1));
}

.bear-ai-modal-header h2 {
    margin: 0;
    font-size: 20px;
    background: linear-gradient(135deg, #0055fd, #ff00aa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bear-ai-modal-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
}

.bear-ai-modal-close:hover {
    background: rgba(255, 0, 100, 0.5);
    transform: rotate(90deg);
}

/* ============================================================
   TABS
   ============================================================ */

.bear-ai-modal-tabs {
    display: flex;
    padding: 15px 25px 0;
    gap: 10px;
}

.bear-ai-tab {
    flex: 1;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.bear-ai-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.bear-ai-tab.active {
    background: rgba(0, 85, 253, 0.2);
    color: white;
    border-color: rgba(0, 85, 253, 0.5);
}

/* ============================================================
   BODY Y SECCIONES
   ============================================================ */

.bear-ai-modal-body {
    padding: 25px;
}

.bear-ai-tab-content {
    display: none;
}

.bear-ai-tab-content.active {
    display: block;
    animation: bearAiFadeIn 0.3s ease;
}

.bear-ai-section {
    margin-bottom: 20px;
}

.bear-ai-section.half {
    flex: 1;
}

.bear-ai-row {
    display: flex;
    gap: 15px;
}

.bear-ai-label {
    display: block;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 500;
}

/* ============================================================
   INPUTS
   ============================================================ */

.bear-ai-textarea,
.bear-ai-input,
.bear-ai-select {
    width: 100%;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: white;
    font-size: 14px;
    transition: all 0.2s;
    box-sizing: border-box;
}

.bear-ai-textarea:focus,
.bear-ai-input:focus,
.bear-ai-select:focus {
    outline: none;
    border-color: rgba(0, 85, 253, 0.6);
    box-shadow: 0 0 20px rgba(0, 85, 253, 0.2);
}

.bear-ai-textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.bear-ai-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
}

.bear-ai-select option {
    background: #1a1a2e;
    color: white;
}

/* ============================================================
   BOTONES
   ============================================================ */

.bear-ai-generate-btn {
    width: 100%;
    padding: 16px 25px;
    background: linear-gradient(135deg, #0055fd, #ff00aa);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.bear-ai-generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 85, 253, 0.4);
}

.bear-ai-generate-btn:active {
    transform: translateY(0);
}

.bear-ai-refresh-btn {
    margin-top: 10px;
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.bear-ai-refresh-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ============================================================
   WARNING
   ============================================================ */

.bear-ai-warning {
    padding: 12px 15px;
    background: rgba(255, 193, 7, 0.15);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 8px;
    color: #ffc107;
    font-size: 13px;
    margin-bottom: 15px;
}

/* ============================================================
   PREVIEW DE REMOCIÓN DE FONDO
   ============================================================ */

.bear-ai-preview-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    margin-bottom: 20px;
}

.bear-ai-preview-box {
    text-align: center;
}

.bear-ai-preview-box label {
    display: block;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}

.bear-ai-preview-img {
    width: 150px;
    height: 150px;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
}

.bear-ai-preview-img.checkerboard {
    background-image: 
        linear-gradient(45deg, #333 25%, transparent 25%),
        linear-gradient(-45deg, #333 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #333 75%),
        linear-gradient(-45deg, transparent 75%, #333 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    background-color: #222;
}

.bear-ai-preview-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.bear-ai-preview-arrow {
    font-size: 30px;
    color: rgba(0, 85, 253, 0.8);
}

/* ============================================================
   ÁREA DE RESULTADO
   ============================================================ */

.bear-ai-result-area {
    padding: 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

/* Loading */
.bear-ai-loading {
    text-align: center;
    padding: 40px;
}

.bear-ai-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #0055fd;
    border-right-color: #ff00aa;
    border-radius: 50%;
    animation: bearAiSpin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes bearAiSpin {
    to { transform: rotate(360deg); }
}

.bear-ai-loading p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 15px;
    margin: 0;
}

/* Resultado */
.bear-ai-result {
    text-align: center;
}

.bear-ai-result img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    margin-bottom: 20px;
    background-image: 
        linear-gradient(45deg, #333 25%, transparent 25%),
        linear-gradient(-45deg, #333 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #333 75%),
        linear-gradient(-45deg, transparent 75%, #333 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    background-color: #222;
}

.bear-ai-result-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.bear-ai-result-actions button {
    padding: 12px 25px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.bear-ai-result-actions button:first-child {
    background: linear-gradient(135deg, #0055fd, #00aaff);
    color: white;
}

.bear-ai-result-actions button:nth-child(2) {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.bear-ai-result-actions button:last-child {
    background: rgba(255, 50, 50, 0.2);
    color: #ff6b6b;
    border: 1px solid rgba(255, 50, 50, 0.3);
}

.bear-ai-result-actions button:hover {
    transform: translateY(-2px);
}

/* ============================================================
   SCROLLBAR
   ============================================================ */

.bear-ai-modal::-webkit-scrollbar {
    width: 8px;
}

.bear-ai-modal::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.bear-ai-modal::-webkit-scrollbar-thumb {
    background: rgba(0, 85, 253, 0.4);
    border-radius: 4px;
}

.bear-ai-modal::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 85, 253, 0.6);
}

/* ============================================================
   BOTÓN DE TOOLBAR
   ============================================================ */

.bear-ai-toolbar-btn {
    background: linear-gradient(135deg, #0055fd, #ff00aa) !important;
    position: relative;
    overflow: hidden;
}

.bear-ai-toolbar-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 40%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 60%
    );
    animation: bearAiShine 3s infinite;
}

@keyframes bearAiShine {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 600px) {
    .bear-ai-modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .bear-ai-row {
        flex-direction: column;
    }
    
    .bear-ai-preview-container {
        flex-direction: column;
    }
    
    .bear-ai-preview-arrow {
        transform: rotate(90deg);
    }
    
    .bear-ai-result-actions {
        flex-direction: column;
    }
    
    .bear-ai-result-actions button {
        width: 100%;
    }
}