/* Query Prioritization Styles */
.query-priority-container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Poppins', sans-serif;
    background: #fff;
}

/* Header */
.query-priority-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.1);
}

.query-priority-header p {
    color: #666;
    font-size: 16px;
    margin: 0;
}

/* Global Recap */
.global-recap {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

/* Responsive: 6 cards sur une ligne sur très grands écrans */
@media (min-width: 1600px) {
    .global-recap {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* Responsive: 3 cards par ligne sur écrans moyens */
@media (max-width: 1599px) {
    .global-recap {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Responsive: 2 cards par ligne sur tablettes */
@media (max-width: 900px) {
    .global-recap {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Responsive: 1 card par ligne sur mobile */
@media (max-width: 600px) {
    .global-recap {
        grid-template-columns: 1fr;
    }
}

.recap-card {
    border-radius: 5px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid #e5e5e5;
    transition: transform 0.3s ease;
}

.recap-label {
    color: #000;
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.recap-icon {
    font-size: 14px;
    opacity: 0.9;
    color: #7B7DFE;
}

.recap-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.recap-value {
    color: #000;
    font-size: 28px;
    font-weight: 700;
}

/* Controls Panel */
.query-priority-controls {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.collapse-btn {
    width: 100%;
    background: #fff;
    color: #000;
    border: 1px solid #000;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    justify-content: center;
}

.collapse-btn:hover {
    background: #f0f0ff;
    color: #000;
}

.collapse-btn i {
    transition: transform 0.3s ease;
}

.collapse-btn.collapsed i {
    transform: rotate(180deg);
}

.controls-content {
    margin-top: 24px;
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.4s ease;
}

.controls-content.collapsed {
    max-height: 0;
    opacity: 0;
}

/* Control Sections */
.control-section {
    margin-bottom: 30px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e5e7eb;
}

.control-section:last-child {
    border-bottom: none;
}

.help-text {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 12px;
}

/* Form Elements */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Filter Groups */
.filter-group {
    margin-bottom: 16px;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
}

.filter-tags-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-input {
    flex: 1;
}

.filter-input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-add-filter {
    width: 40px;
    height: 40px;
}

.btn-add-filter:hover {
    background: #111;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ede9fe;
    color: #5b21b6;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.btn-remove-tag {
    background: none;
    color: #5b21b6;
    font-size: 18px;
    padding: 0;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.btn-remove-tag:hover {
    opacity: 1;
}

/* Weighting */
.weighting-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.weighting-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.weight-keyword {
    flex: 2;
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
}

.weight-value {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
}

.weight-keyword:focus,
.weight-value:focus {
    outline: none;
    border-color: #667eea;
}

.btn-remove-weight {
    width: 40px;
    height: 40px;
    background: #ef4444;
    color: white;
}

.btn-remove-weight:hover {
    background: #FC554F;
}

.btn-add-weighting {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s ease;
    align-self: flex-start;
}

.btn-add-weighting:hover {
    background: #666;
}

/* Control Actions */
.control-actions {
    margin-top: 24px;
    display: flex;
    justify-content: center;
}

.btn-analyze {
    padding: 14px 32px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-analyze:hover {
    background: #333;
    color: #fff;
}

.btn-analyze:disabled {
    cursor: not-allowed;
    background: #666;
    color: #fff;
}

/* Loading */
.loading-message {
    text-align: center;
    padding: 60px 20px;
}

.loader-animation {
    width: 60px;
    height: 60px;
    border: 4px solid #e5e7eb;
    border-top-color: #667eea;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

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

.loading-message p {
    color: #374151;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
}

.loader-detail {
    color: #6b7280;
    font-size: 14px;
}

/* Results */
.results-container {
    margin-top: 30px;
}

.results-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 24px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 500;
    color: #000;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: #374151;
    background: #f9fafb;
}

.tab-btn.active {
    border-width: 3px;
    box-shadow: 0 3px 8px rgba(123, 125, 254, 0.15);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    color: #7B7DFE;
    background: #F0F0FF;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Table Actions */
.table-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 16px;
}

.search-input {
    flex: 1;
    max-width: 400px;
}

.btn-export {
    padding: 10px 10px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 500;
    gap: 8px;
    transition: background 0.2s ease;
}

.btn-export:hover {
    background: #666;
}

/* Table */
.table-wrapper {
    overflow-x: auto;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.results-table thead th {
    color: #000;
}

.results-table thead {
    background: #f8f9fa;
}

.results-table th {
    padding: 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}

.results-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 28px;
}

.results-table th.sortable:hover {
    background: #f1f3f5;
}

.results-table th.sortable::after {
    content: '⇅';
    position: absolute;
    right: 12px;
    opacity: 0.3;
}

.results-table th.sortable.sorted-asc::after {
    content: '↑';
    opacity: 1;
    color: #667eea;
}

.results-table th.sortable.sorted-desc::after {
    content: '↓';
    opacity: 1;
    color: #667eea;
}

.results-table tbody tr {
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.2s ease;
}

.results-table tbody tr:hover {
    background: #f9fafb;
}

.results-table td {
    padding: 14px 16px;
    font-size: 14px;
    color: #374151;
}

.results-table td:first-child {
    font-weight: 500;
}

.url-cell {
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.url-cell a {
    color: #667eea;
    text-decoration: none;
}

.url-cell a:hover {
    text-decoration: underline;
}

.number-cell {
    font-family: 'Courier New', monospace;
    text-align: right;
    font-weight: 600;
}

.positive-value {
    color: #10b981;
}

.neutral-value {
    color: #6b7280;
}

/* Limit Notice */
.limit-notice {
    border: 1px solid #7B7DFE;
    border-radius: 10px;
    padding: 16px 20px;
    margin: 20px 0;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;

    color: #7B7DFE;
    background: #F0F0FF;
}

.limit-notice i {
    font-size: 18px;
    color: #6366f1;
}

/* GSC Not Connected */
.gsc-not-connected {
    padding: 20px;
    background: #fef3c7;
    border: 2px solid #fbbf24;
    border-radius: 8px;
    text-align: center;
}

.gsc-not-connected p {
    color: #92400e;
    margin-bottom: 12px;
}

.btn-connect-gsc {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.2s ease;
}

.btn-connect-gsc:hover {
    background: #5568d3;
}

/* Top Queries in Pages Table */
.top-queries-cell {
    padding: 8px 16px !important;
}

.top-queries-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    padding-bottom: 0px !important;
    gap: 6px;
}

.top-queries-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
    border-bottom: 1px solid #f3f4f6;
}

.top-queries-list li:last-child {
    border-bottom: none;
}

.query-text {
    flex: 1;
    font-size: 13px;
    color: #4b5563;
}

.clickable-query {
    color: #000;
    text-decoration: underline;
    text-decoration-style: dotted;
}

.clickable-query:hover {
    color: #5568d3;
    text-decoration-style: solid;
}

.query-gain {
    font-size: 12px;
    font-weight: 600;
    color: #10b981;
    white-space: nowrap;
}

/* CTR by Type Section */
.ctr-by-type {
    margin-bottom: 30px;
}

.ctr-summary {
    background: #f9fafb;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

.ctr-summary h3 {
    margin-bottom: 20px;
}

.ctr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.ctr-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.ctr-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.ctr-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ctr-card-count {
    font-size: 11px;
    font-weight: 500;
    color: #9ca3af;
}

.ctr-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ctr-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.ctr-position {
    color: #6b7280;
    font-weight: 500;
}

.ctr-value {
    color: #10b981;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .global-recap {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .table-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input {
        max-width: none;
    }

    .results-table {
        font-size: 12px;
    }

    .results-table th,
    .results-table td {
        padding: 10px 8px;
    }

    .ctr-grid {
        grid-template-columns: 1fr;
    }

    .top-queries-list {
        font-size: 12px;
    }
}

