/* Enhanced Driver Rating System Styles */

/* Base form styling */
.driver-rating-form {
    max-width: 600px;
    margin: 20px auto;
    padding: 30px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.driver-rating-form.enhanced {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e9ecef;
}

.driver-rating-form h2 {
    color: #2c3e50;
    margin-bottom: 25px;
    text-align: center;
    font-weight: 600;
    font-size: 24px;
}

/* Rating sections */
.rating-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.rating-section h3 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 18px;
    font-weight: 500;
}

/* Enhanced star ratings */
.rating-stars {
    direction: rtl;
    unicode-bidi: bidi-override;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    position: relative;
}

.rating-stars.main-rating {
    justify-content: center;
    margin: 10px 0;
}

.rating-stars input {
    display: none;
}

.rating-stars label {
    font-size: 32px;
    color: #ddd;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    line-height: 1;
}

.rating-stars.detailed label {
    font-size: 24px;
}

.rating-stars input:checked ~ label,
.rating-stars label:hover,
.rating-stars label:hover ~ label {
    color: #ffd700;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    transform: scale(1.1);
}

.rating-stars input:focus ~ label {
    outline: 2px solid #4CAF50;
    border-radius: 4px;
}

.rating-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 12px;
    color: #6c757d;
}

/* Detailed ratings */
.detailed-ratings {
    margin: 25px 0;
}

.detailed-ratings h3 {
    margin-bottom: 20px;
    color: #495057;
}

.criterion {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.criterion label {
    font-weight: 500;
    color: #495057;
    min-width: 140px;
}

.criterion .rating-stars {
    direction: ltr;
}

/* Comment section */
.comment-section {
    margin: 25px 0;
}

.comment-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #495057;
}

.driver-rating-form textarea {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    resize: vertical;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease;
    background: #ffffff;
}

.driver-rating-form textarea:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.textarea-counter {
    font-size: 12px;
    color: #6c757d;
    text-align: right;
    margin-top: 5px;
    font-weight: 500;
}

.textarea-counter.warning {
    color: #f39c12;
}

.textarea-counter.danger {
    color: #e74c3c;
}

/* Submit button */
.driver-rating-form .submit-button {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
    font-weight: 600;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.driver-rating-form .submit-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.3);
}

.driver-rating-form .submit-button:active {
    transform: translateY(0);
}

.driver-rating-form .submit-button:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.driver-rating-form .submit-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.driver-rating-form .submit-button:hover::before {
    left: 100%;
}

/* Enhanced rating display */
.driver-rating-display {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.driver-rating-display.enhanced {
    flex-direction: column;
    align-items: flex-start;
    max-width: 400px;
}

.rating-summary {
    width: 100%;
}

.main-rating {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.driver-rating-display .star {
    font-size: 24px;
    color: #ddd;
    transition: color 0.2s ease;
}

.driver-rating-display .star.filled {
    color: #ffd700;
    text-shadow: 0 0 3px rgba(255, 215, 0, 0.3);
}

.rating-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rating-value {
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
}

.rating-count {
    font-size: 14px;
    color: #6c757d;
}

/* Rating breakdown */
.rating-breakdown {
    width: 100%;
    margin-top: 15px;
}

.breakdown-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 14px;
}

.breakdown-row .stars {
    min-width: 50px;
    color: #495057;
    font-weight: 500;
}

.breakdown-row .bar {
    flex: 1;
    height: 12px;
    background: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.breakdown-row .fill {
    height: 100%;
    background: linear-gradient(90deg, #ffd700, #ffed4e);
    border-radius: 6px;
    transition: width 0.3s ease;
}

.breakdown-row .count {
    min-width: 30px;
    text-align: right;
    color: #6c757d;
    font-weight: 500;
}

/* Recent ratings */
.recent-ratings {
    max-width: 600px;
    margin: 20px 0;
}

.recent-ratings.enhanced .rating-entry {
    margin-bottom: 20px;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.recent-ratings.enhanced .rating-entry:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.rating-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.rating-date {
    color: #6c757d;
    font-size: 12px;
}

.rating-comment {
    margin: 10px 0;
    color: #495057;
    line-height: 1.6;
    font-style: italic;
}

.driver-response {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-left: 4px solid #4CAF50;
    border-radius: 0 8px 8px 0;
}

.driver-response strong {
    color: #4CAF50;
    font-weight: 600;
}

.driver-response p {
    margin: 8px 0 0 0;
    color: #495057;
}

/* Leaderboard */
.driver-leaderboard {
    max-width: 500px;
    margin: 20px 0;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    overflow: hidden;
}

.driver-leaderboard h3 {
    margin: 0;
    padding: 20px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    text-align: center;
    font-weight: 600;
}

.leaderboard-list {
    padding: 0;
}

.driver-rank {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s ease;
}

.driver-rank:last-child {
    border-bottom: none;
}

.driver-rank:hover {
    background: #f8f9fa;
}

.driver-rank .rank {
    font-size: 18px;
    font-weight: 700;
    color: #4CAF50;
    min-width: 40px;
}

.driver-rank:first-child .rank {
    color: #ffd700;
}

.driver-rank:nth-child(2) .rank {
    color: #c0c0c0;
}

.driver-rank:nth-child(3) .rank {
    color: #cd7f32;
}

.driver-info {
    flex: 1;
    margin-left: 15px;
}

.driver-info .name {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.driver-info .rating {
    display: flex;
    align-items: center;
    gap: 8px;
}

.driver-info .value {
    font-size: 14px;
    color: #6c757d;
}

/* Modal styles */
.rating-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.rating-modal.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.rating-modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    animation: slideIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.rating-modal-content h3 {
    color: #4CAF50;
    margin-bottom: 15px;
    font-size: 22px;
}

.rating-modal-content p {
    color: #495057;
    margin-bottom: 20px;
    line-height: 1.6;
}

.rating-modal-content button {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s ease;
}

.rating-modal-content button:hover {
    background: #45a049;
}

/* Admin styles */
.driver-ratings-admin {
    background: #f1f1f1;
    padding: 20px;
}

.driver-ratings-admin .wrap {
    background: #ffffff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.filter-group {
    display: flex;
    flex-direction: column;
    min-width: 150px;
}

.filter-group label {
    margin-bottom: 5px;
    font-weight: 600;
    color: #495057;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group input,
.filter-group select {
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    background: #ffffff;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.filter-group .button {
    margin-top: auto;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Enhanced table styles */
.driver-ratings-admin .wp-list-table {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.driver-ratings-admin .wp-list-table th {
    background: linear-gradient(135deg, #495057 0%, #343a40 100%);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 12px;
    padding: 15px 12px;
}

.driver-ratings-admin .wp-list-table th a {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
}

.driver-ratings-admin .wp-list-table th a:hover {
    color: #4CAF50;
}

.driver-ratings-admin .wp-list-table td {
    padding: 15px 12px;
    vertical-align: middle;
    border-bottom: 1px solid #e9ecef;
}

.driver-ratings-admin .wp-list-table tr:hover {
    background: #f8f9fa;
}

.rating-status {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    border: 2px solid #e9ecef;
    background: #ffffff;
    transition: all 0.3s ease;
}

.rating-status:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.apply-status,
.quick-approve,
.quick-reject,
.delete-rating {
    padding: 8px 15px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.apply-status {
    background: #17a2b8;
    color: white;
}

.apply-status:hover {
    background: #138496;
}

.quick-approve {
    background: #28a745;
    color: white;
}

.quick-approve:hover {
    background: #218838;
}

.quick-reject {
    background: #ffc107;
    color: #212529;
}

.quick-reject:hover {
    background: #e0a800;
}

.delete-rating {
    background: #dc3545;
    color: white;
}

.delete-rating:hover {
    background: #c82333;
}

.apply-status:disabled,
.quick-approve:disabled,
.quick-reject:disabled,
.delete-rating:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.status-message {
    margin-top: 8px;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 8px;
    border-radius: 4px;
    display: none;
}

.status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

/* Analytics dashboard */
.analytics-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.analytics-cards .card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.analytics-cards .card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.analytics-cards .card h3 {
    margin: 0 0 15px 0;
    color: #6c757d;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.analytics-cards .card .metric {
    font-size: 32px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
}

.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.chart-section {
    background: #ffffff;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.chart-section h3 {
    margin: 0 0 20px 0;
    color: #495057;
    font-weight: 600;
    text-align: center;
}

/* Dashboard widget */
.rating-stats.enhanced {
    padding: 15px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.stat-item strong {
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
}

.widget-actions {
    display: flex;
    gap: 10px;
}

.widget-actions .button {
    flex: 1;
    text-align: center;
    font-size: 12px;
    padding: 8px 12px;
}

/* Flag system */
.flag-button {
    background: #ffc107;
    color: #212529;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.flag-button:hover {
    background: #e0a800;
}

.flagged-indicator {
    display: inline-block;
    background: #dc3545;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Notification system */
#rating-notifications {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 350px;
}

.rating-notification {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    animation: slideInRight 0.3s ease;
    position: relative;
}

.rating-notification.success {
    border-left: 4px solid #28a745;
}

.rating-notification.error {
    border-left: 4px solid #dc3545;
}

.rating-notification.info {
    border-left: 4px solid #17a2b8;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.rating-notification .close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: #6c757d;
}

/* Responsive design */
@media (max-width: 768px) {
    .driver-rating-form {
        margin: 10px;
        padding: 20px;
    }
    
    .filter-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .filter-group {
        width: 100%;
        min-width: auto;
    }
    
    .analytics-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .charts-container {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .main-rating {
        flex-direction: column;
        gap: 10px;
    }
    
    .criterion {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .criterion label {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .rating-stars label {
        font-size: 28px;
    }
    
    .rating-stars.detailed label {
        font-size: 20px;
    }
    
    .driver-rating-form {
        padding: 15px;
    }
    
    .analytics-cards {
        grid-template-columns: 1fr;
    }
    
    .rating-modal-content {
        width: 95%;
        padding: 20px;
    }
}

/* Print styles */
@media print {
    .driver-rating-form .submit-button,
    .filter-row,
    .rating-modal,
    #rating-notifications {
        display: none !important;
    }
    
    .driver-ratings-admin {
        background: white !important;
    }
    
    .wp-list-table th {
        background: #f8f9fa !important;
        color: #000 !important;
    }
}

/* Accessibility improvements */
.rating-stars label:focus-visible {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
    border-radius: 4px;
}

.submit-button:focus-visible,
.apply-status:focus-visible,
.quick-approve:focus-visible,
.quick-reject:focus-visible,
.delete-rating:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .rating-stars input:checked ~ label,
    .rating-stars label:hover {
        color: #000000;
        background: #ffff00;
    }
    
    .driver-rating-form,
    .rating-entry,
    .card {
        border: 2px solid #000000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .rating-stars label,
    .submit-button,
    .rating-entry,
    .card,
    .driver-rank {
        transition: none;
    }
    
    .rating-modal-content {
        animation: none;
    }
    
    .rating-notification {
        animation: none;
    }
}

/* Show rating number next to stars */
.rating-stars label::after {
    content: "(" attr(data-rating) ")";
    position: absolute;
    top: 50%;
    right: -25px;
    transform: translateY(-50%);
    font-size: 14px;
    color: #495057;
    font-weight: 600;
    opacity: 1;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #e9ecef;
}

.rating-stars.main-rating label::after {
    right: -30px;
    font-size: 16px;
}

.rating-stars.detailed label::after {
    right: -23px;
    font-size: 12px;
}