/* ==========================================================================
   Estilo Tech Smart Compare - CSS
   ========================================================================== */

/* Ficha Técnica (Shortcode) */
.esc-ficha-container {
    margin: 2rem 0;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.esc-ficha-header {
    background: #f8f9fa;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-bottom: 1px solid #e1e1e1;
}

.esc-ficha-image {
    margin-bottom: 15px;
}

.esc-ficha-image img {
    max-width: 150px;
    height: auto;
    border-radius: 4px;
}

.esc-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.esc-btn-primary {
    background: #8BC34A; /* Verde TudoCelular/EstiloTech */
    color: #fff;
}

.esc-btn-primary:hover {
    background: #7CB342;
}

.esc-btn-danger {
    background: #f44336;
    color: #fff;
    font-size: 18px;
    padding: 5px 12px;
}

.esc-btn-danger:hover {
    background: #d32f2f;
}

.esc-ficha-table, .esc-compare-table {
    width: 100%;
    border-collapse: collapse;
}

.esc-ficha-table th, .esc-ficha-table td,
.esc-compare-table th, .esc-compare-table td {
    padding: 12px 20px;
    border-bottom: 1px solid #eee;
    text-align: left;
}

.esc-ficha-table .esc-group-header td,
.esc-compare-table .esc-group-header td {
    background: #5042bb;
    color: #fff;
    font-weight: bold;
    text-align: center;
    text-transform: uppercase;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

.esc-ficha-table .esc-spec-label,
.esc-compare-table .esc-spec-label {
    width: 40%;
    font-weight: bold;
    color: #333;
}

.esc-ficha-table td:not(.esc-spec-label):not([colspan]),
.esc-compare-table td:not(.esc-spec-label):not([colspan]) {
    color: #555;
}

/* Compare Table Specifics */
.esc-compare-table th.esc-phone-col {
    text-align: center;
    background: #fcfcfc;
}

.esc-compare-table th.esc-phone-col img {
    max-height: 120px;
    width: auto;
    margin-bottom: 10px;
    border-radius: 4px;
}

.esc-compare-table th.esc-phone-col h3 {
    font-size: 1.1rem;
    margin: 0;
    color: #333;
}

/* Floating Bar Base */
#esc-floating-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 999999;
    transition: transform 0.3s ease-in-out;
}

/* Minimized State */
#esc-floating-bar.esc-minimized #esc-floating-expanded {
    display: none;
}
#esc-floating-bar.esc-minimized {
    width: auto;
    left: auto;
    right: 30px;
}
#esc-floating-minimized {
    display: none;
    background: #333;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.2);
}
#esc-floating-bar.esc-minimized #esc-floating-minimized {
    display: flex;
    align-items: center;
}
#esc-floating-minimized:hover {
    background: #444;
}

/* Expanded State */
#esc-floating-expanded {
    background: #333;
    color: #fff;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.2);
}
#esc-floating-bar:not(.esc-minimized) #esc-floating-minimized {
    display: none;
}

/* Search Container */
.esc-search-container {
    position: relative;
    flex: 1;
    margin-right: 20px;
    max-width: 300px;
}
#esc-search-input {
    width: 100%;
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #555;
    background: #222;
    color: #fff;
}
#esc-search-input:focus {
    outline: none;
    border-color: #8BC34A;
}
#esc-search-results {
    position: absolute;
    bottom: calc(100% + 5px);
    left: 0;
    width: 100%;
    background: #fff;
    color: #333;
    border-radius: 4px;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.2);
    max-height: 300px;
    overflow-y: auto;
}
#esc-search-results.esc-hidden {
    display: none;
}
.esc-search-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    gap: 10px;
}
.esc-search-item:last-child {
    border-bottom: none;
}
.esc-search-item:hover {
    background: #f8f9fa;
}
.esc-search-item img {
    width: 25px;
    height: 35px;
    object-fit: cover;
    border-radius: 2px;
}

.esc-floating-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.esc-selected-phones {
    display: flex;
    gap: 15px;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.esc-phone-thumb {
    background: #fff;
    border-radius: 4px;
    padding: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #333;
    position: relative;
    min-width: 150px;
}

.esc-phone-thumb img {
    width: 30px;
    height: 40px;
    object-fit: cover;
}

.esc-phone-thumb span {
    font-size: 0.85rem;
    font-weight: bold;
    line-height: 1.2;
}

.esc-remove-thumb {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #f44336;
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    font-weight: bold;
}

.esc-floating-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Modal */
.esc-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.esc-modal.esc-hidden {
    display: none;
}

.esc-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
}

.esc-modal-content {
    position: relative;
    background: #fff;
    width: 95%;
    max-width: 1200px;
    height: 90vh;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.esc-modal-header {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e1e1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px 8px 0 0;
}

.esc-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.esc-modal-close {
    font-size: 28px;
    cursor: pointer;
    color: #888;
}

.esc-modal-close:hover {
    color: #333;
}

.esc-modal-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* Compare Grid */
.esc-compare-grid {
    display: grid;
    /* Col count is set via inline CSS variable var(--col-count) */
    grid-template-columns: 150px repeat(calc(var(--col-count) - 1), 1fr);
    gap: 1px;
    background: #e1e1e1;
    border: 1px solid #e1e1e1;
}

.esc-grid-row {
    display: contents;
}

.esc-grid-cell {
    background: #fff;
    padding: 15px;
    font-size: 0.95rem;
}

.esc-grid-header .esc-grid-cell {
    background: #f8f9fa;
    text-align: center;
}

.esc-grid-device-col img {
    max-height: 120px;
    width: auto;
    margin-bottom: 10px;
}

.esc-grid-device-col h3 {
    font-size: 1.1rem;
    margin: 0 0 10px 0;
}

.esc-btn-remove-compare {
    background: none;
    border: 1px solid #f44336;
    color: #f44336;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.esc-btn-remove-compare:hover {
    background: #f44336;
    color: #fff;
}

.esc-group-title .esc-grid-cell {
    background: #e9ecef;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9rem;
    color: #495057;
}

.esc-grid-label-col {
    font-weight: bold;
    color: #555;
    background: #fdfdfd;
}

.esc-loader {
    text-align: center;
    padding: 50px;
    font-size: 1.2rem;
    color: #666;
}

/* Responsiveness */
@media (max-width: 768px) {
    .esc-compare-grid {
        display: block;
    }
    
    /* Fallback layout for very small screens or make grid scrollable */
    .esc-modal-body {
        padding: 0;
    }
    .esc-compare-grid {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
    }
    .esc-grid-row {
        display: flex;
        flex-direction: column;
        min-width: 80vw;
        scroll-snap-align: start;
        border-right: 1px solid #e1e1e1;
    }
    /* We'll leave advanced table mobile responsiveness to a CSS framework or scroll */
}
