/* Rank Tracker Frontend Styles */

.rank-tracker-frontend {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    max-width: 100%;
    margin: 0 auto;
}

.rank-tracker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e1e5e9;
}

.rank-tracker-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 24px;
    font-weight: 600;
}

.last-update {
    color: #7f8c8d;
    font-size: 14px;
    font-style: italic;
}

.no-data {
    text-align: center;
    padding: 60px 20px;
    color: #7f8c8d;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

.no-data p {
    margin: 0;
    font-size: 16px;
}

.rankings-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

.rankings-filters {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.rankings-filters select,
.rankings-filters input {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.rankings-filters select:focus,
.rankings-filters input:focus {
    outline: 0;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25);
}

.rankings-filters input[type="text"] {
    min-width: 200px;
}

.rankings-stats {
    display: flex;
    justify-content: space-around;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rankings-table-wrapper {
    overflow-x: auto;
}

.rankings-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.rankings-table th {
    background: #495057;
    color: white;
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rankings-table td {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.rankings-table tbody tr:hover {
    background: #f8f9fa;
}

.rankings-table tbody tr:last-child td {
    border-bottom: none;
}

.keyword-cell {
    font-weight: 600;
    color: #2c3e50;
}

.page-cell a {
    color: #007bff;
    text-decoration: none;
    transition: color 0.15s ease-in-out;
}

.page-cell a:hover {
    color: #0056b3;
    text-decoration: underline;
}

.position-cell {
    text-align: center;
}

.position-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 13px;
    min-width: 35px;
    text-align: center;
    color: white;
}

.position-badge.position-top {
    background: linear-gradient(135deg, #28a745, #20c997);
    box-shadow: 0 2px 4px rgba(40,167,69,0.3);
}

.position-badge.position-good {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    color: #212529;
    box-shadow: 0 2px 4px rgba(255,193,7,0.3);
}

.position-badge.position-low {
    background: linear-gradient(135deg, #dc3545, #e83e8c);
    box-shadow: 0 2px 4px rgba(220,53,69,0.3);
}

.change-cell {
    text-align: center;
}

.change-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    min-width: 80px;
    justify-content: center;
}

.change-indicator.improved {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    border: 1px solid #c3e6cb;
}

.change-indicator.declined {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.change-indicator.same {
    background: linear-gradient(135deg, #e2e3e5, #d6d8db);
    color: #383d41;
    border: 1px solid #d6d8db;
}

.change-indicator.new {
    background: linear-gradient(135deg, #cce5ff, #b3d7ff);
    color: #004085;
    border: 1px solid #b3d7ff;
}

.change-icon {
    font-size: 16px;
    font-weight: bold;
}

.change-text {
    font-size: 11px;
}

.date-cell {
    color: #6c757d;
    font-size: 13px;
}

.rankings-footer {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.disclaimer {
    margin: 0;
    font-size: 12px;
    color: #6c757d;
    text-align: center;
    font-style: italic;
}

/* Widget Styles */
.rank-tracker-widget {
    font-family: inherit;
}

.rank-tracker-widget .rank-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.rank-tracker-widget .rank-table th {
    background: #f8f9fa;
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
}

.rank-tracker-widget .rank-table td {
    padding: 8px;
    border-bottom: 1px solid #f1f3f4;
}

.rank-tracker-widget .rank-table tr:hover {
    background: #f8f9fa;
}

.rank-tracker-widget .improved {
    color: #28a745;
    font-weight: bold;
}

.rank-tracker-widget .declined {
    color: #dc3545;
    font-weight: bold;
}

.rank-tracker-widget .same {
    color: #6c757d;
}

/* Responsive Design */
@media (max-width: 768px) {
    .rank-tracker-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .rank-tracker-header h3 {
        font-size: 20px;
    }
    
    .rankings-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .rankings-filters select,
    .rankings-filters input {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .rankings-stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .stat-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .stat-number {
        font-size: 24px;
    }
    
    .rankings-table {
        font-size: 13px;
    }
    
    .rankings-table th,
    .rankings-table td {
        padding: 8px 6px;
    }
    
    .position-badge {
        font-size: 11px;
        padding: 4px 8px;
    }
    
    .change-indicator {
        font-size: 10px;
        padding: 4px 6px;
        min-width: 60px;
    }
}

@media (max-width: 480px) {
    .rank-tracker-header h3 {
        font-size: 18px;
    }
    
    .stat-number {
        font-size: 20px;
    }
    
    .rankings-table th,
    .rankings-table td {
        padding: 6px 4px;
    }
    
    .rankings-table th {
        font-size: 12px;
    }
    
    .rankings-table td {
        font-size: 12px;
    }
    
    .position-badge {
        font-size: 10px;
        padding: 3px 6px;
        min-width: 25px;
    }
    
    .change-indicator {
        font-size: 9px;
        padding: 3px 4px;
        min-width: 50px;
    }
    
    .change-icon {
        font-size: 12px;
    }
}

/* Animation Effects */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rank-tracker-frontend {
    animation: fadeIn 0.5s ease-out;
}

.rankings-table tbody tr {
    animation: fadeIn 0.3s ease-out;
}

.rankings-table tbody tr:nth-child(1) { animation-delay: 0.1s; }
.rankings-table tbody tr:nth-child(2) { animation-delay: 0.2s; }
.rankings-table tbody tr:nth-child(3) { animation-delay: 0.3s; }
.rankings-table tbody tr:nth-child(4) { animation-delay: 0.4s; }
.rankings-table tbody tr:nth-child(5) { animation-delay: 0.5s; }

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

