/**
 * MeshAds Styling for Media Studio
 * Product Performance Tracking
 */

.meshads-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 0;
}

/* Controls Section */
.meshads-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    padding: 0;
    /* Removed border/box styling - already in modern-card */
    background: transparent;
    border-radius: 0;
    border: none;
    box-shadow: none;
    transition: all 0.3s ease;
}

.meshads-controls:hover {
    box-shadow: none;
}

.meshads-controls .form-group {
    margin: 0;
}

.meshads-controls .input-label {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
    display: block;
}

.meshads-controls .modern-select {
    width: 100%;
    padding: 10px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background-color: white;
    font-size: 14px;
    color: #0f172a;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.meshads-controls .modern-select:hover {
    border-color: var(--primary-color, #4f46e5);
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%234f46e5' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.meshads-controls .modern-select:focus {
    outline: none;
    border-color: var(--primary-color, #4f46e5);
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%234f46e5' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* Range Buttons */
.range-buttons-campaigns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.range-btn {
    padding: 10px 20px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.range-btn:hover {
    border-color: var(--primary-color, #4f46e5);
    color: var(--primary-color, #4f46e5);
    background: rgba(79, 70, 229, 0.04);
}

.range-btn.active {
    background: rgba(79, 70, 229, 0.08);
    color: var(--primary-color, #4f46e5);
    border-color: var(--primary-color, #4f46e5);
    font-weight: 700;
}

/* Table Container */
.meshads-table-container {
    background: white;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 
                0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.meshads-table-container:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 
                0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.meshads-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.meshads-table-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
}

.table-actions {
    display: flex;
    gap: 8px;
}

.btn-secondary {
    padding: 8px 16px;
    background: #e2e8f0;
    color: #334155;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-secondary:hover {
    background: #cbd5e1;
}

/* Table Body */
.meshads-table-body {
    padding: 0;
    max-height: 800px;
    overflow-y: auto;
}

.meshads-product-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.meshads-product-row:hover {
    background: linear-gradient(135deg, #fafbff 0%, #f8fafc 100%);
    transform: translateX(4px);
    box-shadow: inset 4px 0 0 0 rgba(59, 130, 246, 0.3);
}

.meshads-product-row:last-child {
    border-bottom: none;
}

.meshads-product-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 0 0 280px;
    min-width: 0;
}

.meshads-product-index {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #e2e8f0;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    flex-shrink: 0;
}

.meshads-product-details {
    flex: 1;
    min-width: 0;
}

.meshads-product-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.meshads-product-brand {
    margin: 4px 0 0 0;
    font-size: 12px;
    color: #94a3b8;
}

/* Metrics Grid */
.meshads-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
    flex: 1;
}

.meshads-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    text-align: center;
    min-width: 100px;
}

.meshads-metric-label {
    font-size: 11px;
    font-weight: 500;
    color: #94a3b8;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.meshads-metric-value {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
}

.status-metric {
    background: transparent;
    padding: 0;
}

.meshads-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 1400px) {
    .meshads-metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(85px, 1fr));
    }

    .meshads-metric {
        min-width: 85px;
        padding: 10px 8px;
    }

    .meshads-metric-value {
        font-size: 13px;
    }
}

@media (max-width: 1024px) {
    .meshads-controls {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        padding: 0;
    }

    .meshads-product-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .meshads-product-info {
        width: 100%;
        flex: none;
    }

    .meshads-metrics-grid {
        width: 100%;
        grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    }
}

@media (max-width: 768px) {
    .meshads-container {
        padding: 0;
    }

    .meshads-controls {
        grid-template-columns: 1fr;
        padding: 0;
        gap: 12px;
    }

    .range-buttons-campaigns {
        gap: 6px;
    }

    .range-btn {
        flex: 1;
        padding: 6px 12px;
        font-size: 12px;
        min-width: 0;
    }

    .meshads-product-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px 16px;
    }

    .meshads-product-info {
        flex: none;
        width: 100%;
    }

    .meshads-metrics-grid {
        width: 100%;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .meshads-metric {
        padding: 10px 8px;
        min-width: 0;
    }

    .meshads-metric-label {
        font-size: 10px;
    }

    .meshads-metric-value {
        font-size: 13px;
    }

    .meshads-table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 16px;
    }

    .table-actions {
        width: 100%;
    }

    .btn-secondary {
        flex: 1;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .meshads-metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .meshads-metric {
        padding: 8px 6px;
    }

    .meshads-product-index {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .meshads-product-title {
        font-size: 13px;
    }

    .range-btn {
        font-size: 11px;
        padding: 5px 10px;
    }
}

/* Loading State */
.meshads-product-row.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Empty State */
.meshads-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.meshads-empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.meshads-empty-state p {
    font-size: 14px;
    margin: 0;
}

/* No data message styling */
.no-data-message {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
    font-size: 14px;
}

/* Row Actions */
.meshads-row-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.meshads-analyze-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.meshads-analyze-btn:hover {
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.5);
    transform: translateY(-2px);
}

.meshads-analyze-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.meshads-analyze-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Responsive adjustments for actions */
@media (max-width: 1024px) {
    .meshads-row-actions {
        flex-direction: column;
    }

    .meshads-analyze-btn {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .meshads-row-actions {
        width: 100%;
    }

    .meshads-analyze-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Scrollbar styling */
.meshads-table-body::-webkit-scrollbar {
    width: 8px;
}

.meshads-table-body::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.meshads-table-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.meshads-table-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

