* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.test-panel {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* ========== INPUT & CONFIG ========== */
.test-config {
    margin-bottom: 30px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
    font-size: 1.1rem;
}

.input-with-button {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.input-with-button input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-with-button input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-primary {
    padding: 15px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

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

.quick-actions {
    display: flex;
    gap: 10px;
}

.btn-quick {
    padding: 8px 16px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-quick:hover {
    background: #e0e0e0;
}

.test-options {
    display: flex;
    gap: 30px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.option-group {
    flex: 1;
    min-width: 250px;
}

.option-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.select-styled {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
}

.select-styled:focus {
    outline: none;
    border-color: #667eea;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 12px 0;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* ========== FILTROS ========== */
.filter-section {
    margin-bottom: 20px;
}

.filter-section label {
    font-weight: 600;
    margin-bottom: 10px;
    display: block;
    color: #333;
}

.region-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.region-btn {
    padding: 8px 16px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.region-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

.region-btn:hover:not(.active) {
    border-color: #667eea;
}

/* ========== TOOLBAR ========== */
.actions-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.btn-toolbar {
    padding: 10px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-toolbar:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.btn-toolbar.select-all {
    color: #4caf50;
    border-color: #4caf50;
}

.btn-toolbar.deselect-all {
    color: #f44336;
    border-color: #f44336;
}

.selection-count {
    padding: 10px 15px;
    background: #667eea;
    color: white;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    margin-left: auto;
}

/* ========== PROGRESSO ========== */
.progress-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
}

.progress-bar {
    background: #e0e0e0;
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress {
    background: linear-gradient(90deg, #667eea, #764ba2);
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-percentage {
    text-align: right;
    font-weight: 600;
    color: #667eea;
}

/* ========== LOCATIONS GRID ========== */
.locations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

/* ========== LOCATION CARD (NOVO DESIGN) ========== */
.location-card {
    position: relative;
    overflow: hidden;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    padding: 0 !important;
}

.location-card .card-header {
    padding: 12px 15px;
    background: inherit;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.location-card .card-header .location-flag {
    font-size: 1.5rem;
    margin: 0;
    flex-shrink: 0;
}

.location-card .card-header .location-info-compact {
    flex: 1;
    min-width: 0;
}

.location-card .card-header .location-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.location-card .card-header .location-city {
    font-size: 0.7rem;
    color: #666;
}

.location-card .card-header .location-region {
    font-size: 0.65rem;
    color: #999;
    background: #f0f0f0;
    padding: 1px 6px;
    border-radius: 8px;
    display: inline-block;
}

.location-card .card-status {
    padding: 8px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    border-bottom: 1px solid #e0e0e0;
}

.location-card .card-status .status-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.location-card .card-status .location-time {
    font-weight: 700;
    color: #667eea;
    font-size: 0.9rem;
}

/* Card Select Checkbox */
.location-card .card-select {
    position: relative;
    z-index: 3;
    flex-shrink: 0;
}

.location-card .card-select input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

/* Expand Button */
.location-card .btn-expand {
    background: rgba(255,255,255,0.9);
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 3;
    flex-shrink: 0;
}

.location-card .btn-expand:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* ========== MINI PREVIEW ========== */
.location-card .mini-preview-container {
    flex: 1;
    position: relative;
    min-height: 220px;
    background: #f5f5f5;
    overflow: hidden;
    cursor: pointer;
}

.location-card .mini-preview-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: none;
    transform: scale(0.4);
    transform-origin: 0 0;
    width: 250%;
    height: 250%;
}

.location-card .mini-preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 1;
    cursor: pointer;
}

.location-card .preview-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #999;
    font-size: 0.8rem;
}

.location-card .preview-loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
}

/* ========== CARD EXPANDED ========== */
.location-card.expanded {
    position: fixed;
    top: 5%;
    left: 5%;
    width: 90vw;
    height: 90vh;
    z-index: 1000;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    border-radius: 15px;
    border: 3px solid #667eea;
}

.location-card.expanded .mini-preview-container iframe {
    pointer-events: auto;
    transform: scale(1);
    width: 100%;
    height: 100%;
}

/* ========== OVERLAY ========== */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 999;
}

.overlay.show {
    display: block;
}

/* ========== CARD STATES ========== */
.location-card.selected {
    border-color: #667eea;
}

.location-card.deselected {
    opacity: 0.5;
    border-style: dashed;
}

.location-card.deselected .mini-preview-container {
    filter: grayscale(100%);
}

.location-card.testing {
    border-color: #ffa500;
    animation: pulse 1.5s infinite;
}

.location-card.completed {
    border-color: #4caf50;
}

.location-card.error {
    border-color: #f44336;
}

.location-card.blocked {
    border-color: #ff9800;
}

/* ========== STATUS INDICATOR ========== */
.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
    flex-shrink: 0;
}

.status-indicator.testing {
    background: #ffa500;
    animation: pulse 1s infinite;
}

.status-indicator.completed {
    background: #4caf50;
}

.status-indicator.error {
    background: #f44336;
}

.status-indicator.blocked {
    background: #ff9800;
}

/* ========== SPINNER ========== */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

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

/* ========== RESULTS SECTION ========== */
.results-section {
    margin-top: 40px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.results-header h2 {
    color: #333;
}

.btn-export {
    padding: 10px 20px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-export:hover {
    background: #45a049;
    transform: translateY(-2px);
}

.results-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
}

.summary-card h3 {
    margin-bottom: 15px;
    font-size: 1rem;
    opacity: 0.9;
}

.summary-flag {
    font-size: 1.5rem;
}

.summary-city {
    display: block;
    font-weight: 600;
    margin: 5px 0;
}

.summary-time {
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
}

.summary-time-large {
    font-size: 2.5rem;
    font-weight: 700;
    display: block;
}

.summary-subtitle {
    font-size: 0.9rem;
    opacity: 0.8;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.result-card {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    border-left: 4px solid #667eea;
    transition: all 0.3s;
}

.result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.result-card.excellent {
    border-left-color: #4caf50;
}

.result-card.good {
    border-left-color: #8bc34a;
}

.result-card.average {
    border-left-color: #ffa500;
}

.result-card.slow {
    border-left-color: #f44336;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.result-location {
    display: flex;
    align-items: center;
    gap: 10px;
}

.result-flag {
    font-size: 2rem;
}

.result-name {
    font-weight: 600;
    color: #333;
}

.result-city {
    font-size: 0.85rem;
    color: #666;
}

.result-time-main {
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
}

.result-bar-container {
    background: #e0e0e0;
    height: 4px;
    border-radius: 2px;
    margin-bottom: 15px;
    overflow: hidden;
}

.result-bar {
    background: linear-gradient(90deg, #4caf50, #ffa500, #f44336);
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.result-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #666;
}

.detail-row span:last-child {
    font-weight: 600;
    color: #333;
}

/* ========== SECURITY BADGES ========== */
.security-badges {
    margin-bottom: 10px;
}

.security-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-right: 5px;
}

.security-badge.blocked {
    background: #ffebee;
    color: #f44336;
}

.security-badge.warning {
    background: #fff3e0;
    color: #ff9800;
}

.security-badge.ok {
    background: #e8f5e8;
    color: #4caf50;
}

/* ========== DEEP TEST ========== */
.deep-test-info {
    margin-top: 15px;
    padding: 15px;
    background: #f0f4ff;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.deep-test-info h4 {
    margin-bottom: 10px;
    color: #667eea;
}

.resource-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 10px;
}

.resource-stat {
    text-align: center;
    padding: 10px;
    background: white;
    border-radius: 8px;
}

.resource-stat .count {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
}

.resource-stat .label {
    font-size: 0.8rem;
    color: #666;
    margin-top: 5px;
}

/* ========== NOTIFICATIONS ========== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    z-index: 2000;
}

.notification.show {
    transform: translateX(0);
}

.notification-error {
    background: #f44336;
}

.notification-info {
    background: #2196f3;
}

/* ========== NO RESULTS ========== */
.no-results {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 1.2rem;
    grid-column: 1 / -1;
}

/* ========== RESPONSIVO ========== */
@media (max-width: 1024px) {
    .locations-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .test-panel {
        padding: 15px;
    }
    
    .input-with-button {
        flex-direction: column;
    }
    
    .locations-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .location-card .mini-preview-container {
        min-height: 180px;
    }
    
    .location-card.expanded {
        top: 2%;
        left: 2%;
        width: 96vw;
        height: 96vh;
    }
    
    .test-options {
        flex-direction: column;
        gap: 15px;
    }
    
    .region-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 10px;
    }
    
    .region-btn {
        white-space: nowrap;
    }
    
    .results-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}