/**
 * RacingOS Frontend Styles - Modern & Exciting
 */

.racingos-frontend-scope {
    --racingos-primary: #fc2604;
    --racingos-primary-dark: #b81c02;
    --racingos-accent: #00d4ff;
    --racingos-success: #46b450;
    --racingos-error: #dc3232;
    --racingos-bg-glass: rgba(255, 255, 255, 0.85);
    --racingos-border-glass: rgba(255, 255, 255, 0.5);
    --racingos-shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --racingos-radius: 16px;
    --racingos-transition: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --racingos-font: 'Racing Sans One', 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@import url('https://fonts.googleapis.com/css2?family=Racing+Sans+One&family=Outfit:wght@300;400;500;600&display=swap');

/* Main Container - Glassmorphism */
.racingos-widget {
    border: 1px solid var(--racingos-border-glass);
    padding: 30px;
    border-radius: var(--racingos-radius);
    background: var(--racingos-bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--racingos-shadow-glass);
    max-width: 450px;
    margin: 40px auto;
    font-family: var(--racingos-font);
    color: #333;
    animation: slideUpFade 0.6s ease-out;
    position: relative;
    overflow: hidden;
}

/* Subtle gradient border effect */
.racingos-widget::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(90deg, var(--racingos-primary), var(--racingos-accent));
}

.racingos-widget h3 {
    margin-top: 0;
    margin-bottom: 25px;
    font-weight: 600;
    font-size: 1.5rem;
    color: var(--racingos-primary-dark);
    text-align: center;
    letter-spacing: -0.5px;
}

/* Form Groups */
.racingos-form-group {
    margin-bottom: 20px;
    position: relative;
}

.racingos-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    color: #555;
    transition: var(--racingos-transition);
}

.racingos-form-group input,
.racingos-form-group select,
.racingos-form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: rgba(255,255,255,0.9);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--racingos-transition);
    box-sizing: border-box;
    color: #1e293b;
}

.racingos-form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.racingos-form-group input:focus,
.racingos-form-group select:focus,
.racingos-form-group textarea:focus {
    outline: none;
    border-color: var(--racingos-primary);
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
    transform: translateY(-1px);
    background: white;
}

/* Buttons */
.racingos-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--racingos-primary), var(--racingos-primary-dark));
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(0, 81, 119, 0.3);
    transition: var(--racingos-transition);
    position: relative;
    overflow: hidden;
}

.racingos-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 81, 119, 0.4);
    background: linear-gradient(135deg, var(--racingos-primary), var(--racingos-primary-dark));
}

.racingos-btn:active {
    transform: translateY(0);
}

.racingos-btn-primary {
    background: linear-gradient(135deg, var(--racingos-primary), var(--racingos-primary-dark));
    color: #ffffff !important;
}

.racingos-btn-accent {
    background: linear-gradient(135deg, var(--racingos-primary), var(--racingos-accent));
    color: #ffffff !important;
}

.racingos-btn-secondary {
    background: #f1f5f9;
    color: #64748b !important;
    border: 1px solid #e2e8f0;
}

.racingos-btn-secondary:hover {
    background: #e2e8f0;
    color: #1e293b !important;
}

.racingos-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

/* Trip Items */
.racingos-trip-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.racingos-trip-item {
    border: 1px solid transparent;
    padding: 15px;
    border-radius: 12px;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: var(--racingos-transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    animation: fadeInStagger 0.5s ease-out forwards;
    opacity: 0;
}

/* Stagger delay for up to 10 items */
.racingos-trip-item:nth-child(1) { animation-delay: 0.1s; }
.racingos-trip-item:nth-child(2) { animation-delay: 0.2s; }
.racingos-trip-item:nth-child(3) { animation-delay: 0.3s; }
.racingos-trip-item:nth-child(4) { animation-delay: 0.4s; }
.racingos-trip-item:nth-child(5) { animation-delay: 0.5s; }

.racingos-trip-item:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-color: var(--racingos-accent);
}

.racingos-trip-item.selected {
    background: #f0f9ff;
    border-color: var(--racingos-primary);
    box-shadow: 0 0 0 2px var(--racingos-primary) inset;
}

.racingos-frontend-scope .trip-time {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--racingos-primary-dark);
}

.racingos-frontend-scope .trip-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.racingos-frontend-scope .trip-price {
    font-weight: 600;
    color: var(--racingos-success);
}

.racingos-frontend-scope .trip-seats {
    font-size: 0.85rem;
    color: #888;
}

/* Small/Secondary Button */
.racingos-btn-small {
    background: transparent;
    border: 1px solid var(--racingos-primary);
    color: var(--racingos-primary);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--racingos-transition);
    display: inline-block;
    margin-top: 10px;
}

.racingos-btn-small:hover {
    background: var(--racingos-primary);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 115, 170, 0.2);
}

/* Notifications */
.racingos-error {
    background: #fee;
    color: var(--racingos-error);
    padding: 12px;
    border-radius: 8px;
    margin-top: 20px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    border-left: 4px solid var(--racingos-error);
    animation: shake 0.4s ease-in-out;
}

.racingos-success {
    background: #eef9ee;
    color: var(--racingos-success);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: center;
    border: 1px solid #c3e6cb;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.racingos-frontend-scope .success-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    display: block;
}

/* QR Code Section */
.racingos-qr {
    text-align: center;
    margin: 25px 0;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.05);
    border: 1px dashed #ddd;
}

.racingos-qr img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* OTP Section */
.racingos-frontend-scope #otp-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(0,0,0,0.05);
    animation: slideDown 0.4s ease-out;
}

/* Animations */
@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInStagger {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Loading Spinner */
.racingos-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

/* Navigation Buttons */
.racingos-nav-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.racingos-btn-secondary {
    padding: 14px;
    background: transparent;
    border: 1px solid var(--racingos-primary);
    color: var(--racingos-primary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    flex: 1;
    transition: var(--racingos-transition);
}

.racingos-btn-secondary:hover {
    background: rgba(0, 115, 170, 0.05);
}

/* Summary Card */
.racingos-summary-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.racingos-frontend-scope .summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed #eee;
}

.racingos-frontend-scope .summary-row:last-child {
    border-bottom: none;
}

.racingos-frontend-scope .total-row {
    font-size: 1.2rem;
    color: var(--racingos-primary-dark);
    margin-top: 10px;
    padding-top: 15px;
    border-top: 2px solid #eee;
}

/* Responsive */
@media (max-width: 480px) {
    .racingos-widget {
        margin: 20px;
        padding: 20px;
    }
}

/* Step Indicators */
.racingos-steps {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 25px;
    gap: 8px;
}

.racingos-step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.racingos-step-dot.active {
    background: var(--racingos-primary);
    transform: scale(1.3);
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

/* Error UI */
.racingos-input-error {
    border-color: #dc3232 !important; /* WordPress red */
    background-color: #fff8f8;
}

.racingos-error-text {
    color: #dc3232;
    font-size: 0.85rem;
    margin-top: 4px;
    display: block;
    animation: slideUpFade 0.3s ease-out;
}

.racingos-form-error {
    background-color: #fcebeb;
    border: 1px solid #dc3232;
    color: #dc3232;
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    display: none; /* hidden by default */
    animation: shake 0.4s ease-in-out;
}
/* Public Entry List Table */
.racingos-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 20px 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.racingos-table th {
    background: #f8fafc;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.racingos-table td {
    padding: 16px;
    background: white;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.95rem;
}

.racingos-table tr:last-child td {
    border-bottom: none;
}

.rs-tag {
    background: #ef4444;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: 5px;
    vertical-align: middle;
}

.status-tag {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: capitalize;
}

.status-tag.paid {
    background: #dcfce7;
    color: #166534;
}

.status-tag.deposit_paid {
    background: #fef9c3;
    color: #854d0e;
}

.status-tag.pending {
    background: #f1f5f9;
    color: #475569;
}

/* Search Dropdown */
.racingos-frontend-scope .search-results-dropdown {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-top: 5px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 100;
    position: absolute;
    width: 100%;
}

.racingos-frontend-scope .search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: var(--racingos-transition);
}

.racingos-frontend-scope .search-result-item:hover {
    background: #f8fafc;
}

.racingos-frontend-scope .search-result-name {
    font-weight: 600;
    display: block;
    color: #1e293b;
}

.racingos-frontend-scope .search-result-meta {
    font-size: 0.8rem;
    color: #64748b;
}

/* Signature Pad */
.racingos-frontend-scope .signature-pad-container {
    background: white;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    margin: 10px 0;
    cursor: crosshair;
    touch-action: none;
    transition: var(--racingos-transition);
}

.racingos-frontend-scope .signature-pad-container:hover {
    border-color: var(--racingos-primary);
}

.racingos-frontend-scope #signature-pad {
    width: 100%;
    height: 200px;
    display: block;
}
