:root {
    --cotacoes-primary: #2c5530;
    --cotacoes-secondary: #4a7c59;
    --cotacoes-accent: #f0fdf4;
    --cotacoes-text: #333;
    --cotacoes-light: #f8f9fa;
    --cotacoes-border: #e9ecef;
    --cotacoes-success: #28a745;
    --cotacoes-warning: #ffc107;
    --cotacoes-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
}

/* Root Wrapper - Isolamento e Reset */
.cotacoes-widget-root {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--cotacoes-text);
    padding: 20px 0;
    line-height: 1.5;
    width: 100%;
    box-sizing: border-box;
    font-size: 16px; /* Reset base font size */
}

.cotacoes-widget-root * { 
    box-sizing: border-box; 
}

/* Header do Widget */
.cotacoes-header {
    background-color: var(--cotacoes-primary);
    color: white;
    padding: 20px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.cotacoes-title {
    font-size: 24px; /* Garante tamanho legível */
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.cotacoes-status {
    font-size: 14px;
    background: rgba(255,255,255,0.2);
    padding: 6px 16px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cotacoes-status-dot {
    width: 10px;
    height: 10px;
    background-color: #4ade80;
    border-radius: 50%;
    display: inline-block;
}

.cotacoes-status-dot.loading {
    animation: cotacoes-pulse 1.5s infinite;
    background-color: var(--cotacoes-warning);
}

@keyframes cotacoes-pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Main Grid */
.cotacoes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); /* Cards mais largos */
    gap: 24px;
}

/* Cards */
.cotacoes-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--cotacoes-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.cotacoes-card:active {
    transform: scale(0.98);
}

.cotacoes-card:hover {
    border-color: var(--cotacoes-secondary);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
}

.cotacoes-card-icon {
    font-size: 64px; /* Emojis grandes */
    margin-bottom: 16px;
    background: var(--cotacoes-accent);
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    line-height: 1; /* Centralizar emoji verticalmente */
}

.cotacoes-card-title {
    font-weight: 700;
    font-size: 18px; /* Título claro */
    color: var(--cotacoes-text);
    margin-bottom: 8px;
    line-height: 1.3;
}

.cotacoes-card-desc {
    font-size: 14px; /* Descrição legível */
    color: #6b7280;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Modal */
.cotacoes-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999999;
    display: none;
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s;
}

.cotacoes-modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.cotacoes-modal-content {
    background: white;
    width: 95%;
    max-width: 1000px;
    height: 90vh;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    transform: translateY(20px);
    transition: transform 0.3s;
    overflow: hidden;
}

.cotacoes-modal-overlay.active .cotacoes-modal-content {
    transform: translateY(0);
}

.cotacoes-modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--cotacoes-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--cotacoes-accent);
}

.cotacoes-modal-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--cotacoes-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.cotacoes-btn-close {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: #666;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    line-height: 1;
    padding: 0;
}

.cotacoes-btn-close:hover {
    background-color: rgba(0,0,0,0.05);
    color: #333;
}

.cotacoes-modal-body {
    flex: 1;
    position: relative;
    background: #fff;
}

.cotacoes-iframe {
    width: 100%;
    height: 100%;
    border: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.cotacoes-spinner-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    color: #666;
    gap: 15px;
    font-size: 16px;
}

.cotacoes-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e9ecef;
    border-top-color: var(--cotacoes-primary);
    border-radius: 50%;
    animation: cotacoes-spin 1s linear infinite;
}

@keyframes cotacoes-spin {
    to { transform: rotate(360deg); }
}

/* Responsividade */
@media (max-width: 600px) {
    .cotacoes-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 16px;
    }
    
    .cotacoes-card {
        padding: 16px;
    }
    
    .cotacoes-card-icon {
        width: 70px;
        height: 70px;
        font-size: 48px;
    }
    
    .cotacoes-card-title {
        font-size: 16px;
    }
    
    .cotacoes-card-desc {
        font-size: 13px;
    }
    
    .cotacoes-modal-content {
        height: 100vh;
        width: 100%;
        border-radius: 0;
    }
}
