/**
 * Frontend CSS
 *
 * Styles for driver profile dashboard and overlay embeds
 */

/* Driver Profile Dashboard */
.race-overlay-driver-dashboard {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.race-overlay-driver-dashboard h2 {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #ff0000;
    color: #333;
}

.race-overlay-notice,
.race-overlay-success,
.race-overlay-error {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
}

.race-overlay-notice {
    background: #f0f0f0;
    border-left: 4px solid #999;
}

.race-overlay-success {
    background: #d4edda;
    border-left: 4px solid #28a745;
    color: #155724;
}

.race-overlay-error {
    background: #f8d7da;
    border-left: 4px solid #dc3545;
    color: #721c24;
}

/* Profile Form */
.driver-profile-form .profile-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 5px;
}

.driver-profile-form .profile-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #ff0000;
}

.driver-profile-form .form-group {
    margin-bottom: 15px;
}

.driver-profile-form .form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.driver-profile-form .form-group input[type="text"],
.driver-profile-form .form-group input[type="email"],
.driver-profile-form .form-group input[type="url"],
.driver-profile-form .form-group input[type="file"],
.driver-profile-form .form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
}

.driver-profile-form .form-group input:disabled {
    background: #f0f0f0;
    color: #666;
}

.driver-profile-form .form-group .description {
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

/* Current Image */
.current-image {
    margin-bottom: 15px;
}

.current-image img {
    border: 2px solid #ddd;
    border-radius: 5px;
}

/* Track Checkboxes */
.track-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.track-checkbox {
    display: flex;
    align-items: center;
    padding: 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.track-checkbox:hover {
    background: #f0f0f0;
}

.track-checkbox input[type="checkbox"] {
    margin-right: 10px;
    width: auto;
}

/* Form Actions */
.form-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.button-primary {
    background: #ff0000;
    color: #fff;
    border: none;
    padding: 12px 30px;
    border-radius: 3px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.button-primary:hover {
    background: #cc0000;
}

/* Overlay Embed */
.race-overlay-embed {
    margin: 20px 0;
}

.race-overlay-embed iframe {
    border: 2px solid #ddd;
    border-radius: 5px;
}

/* Data Tables - Original Design + Fixed Dimensions */
.data-table {
    width: auto;
    border-collapse: collapse;
}

.data-table thead {
    background: #000000;
    color: white;
}

.data-table th {
    padding: 0px 2px;
    text-align: left;
    font-weight: bold;
    font-size: 13px;
}

.data-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
}

.data-table td {
    padding: 0px 2px;
    background: white;
    color: #000000;
    font-size: 13px;
}

/* Column widths */
.data-table th.driver-col,
.data-table td.driver-col {
    min-width: 0px;
    max-width: none;
    font-weight: bold;
}

.data-table th.metric-col,
.data-table td.metric-col {
    font-family: monospace;
    font-size: 14px;
}

/* 3-column table metric spacing - only for tables with 2 metric columns */
.data-table th.metric-col:nth-child(3):not(:last-child),
.data-table td.metric-col:nth-child(3):not(:last-child),
.data-table th.metric-col:nth-child(4),
.data-table td.metric-col:nth-child(4) {
    padding-left: 15px;
}

/* Position change column */
.data-table th.pos-col,
.data-table td.pos-col {
    width: 30px;
    text-align: center;
    padding: 0px 5px 1px 5px;
}

.data-table th.pos-col {
    font-size: 0;
}

/* Position Change Indicators */
.pos-change {
    font-size: 16px;
    font-weight: bold;
}

.pos-change.up {
    color: #00ff00;
}

.pos-change.down {
    color: #ff0000;
}

/* Legacy position change support */
.position-change {
    display: inline-block;
    font-weight: bold;
    font-size: 1.2em;
    margin-left: 5px;
    animation: fadeIn 0.3s ease-in;
}

.position-change.up {
    color: #00ff00 !important;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
}

.position-change.down {
    color: #ff0000 !important;
    text-shadow: 0 0 5px rgba(255, 0, 0, 0.5);
}

/* Done/Finished rows */
.data-table tr.done td {
    background: #8BC34A !important;
    color: white;
}

/* Row animation when position changes */
tr.position-changed {
    animation: pulseRow 1s ease-out;
    border-left: 3px solid #ffd700 !important;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.5);
    }
}

@keyframes pulseRow {
    0%, 100% {
        background-color: inherit;
    }
    50% {
        background-color: rgba(255, 215, 0, 0.3);
    }
}

/* Hide progress bars (optional) */
tr.racer-line-border,
tr[class*="border"] {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .race-overlay-driver-dashboard {
        padding: 15px;
    }

    .driver-profile-form .profile-section {
        padding: 15px;
    }
}
