/* Layout and Structure */

/* Header section */
.header-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
    position: relative;
    gap: 1rem;
    text-align: center;
}

/* Help toggle button */
.help-toggle-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.help-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Help Panel */
.help-panel {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 1rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.8);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.4s ease;
}

.help-panel.open {
    opacity: 1;
    transform: translateY(0);
}

.help-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.help-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.help-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.help-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.help-content {
    padding: 2rem;
}

.help-section {
    margin-bottom: 2rem;
}

.help-section h4 {
    color: #2d3748;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.help-section p {
    color: #4a5568;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.help-item {
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.help-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.help-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: block;
}

.help-text strong {
    color: #2d3748;
    font-size: 1.1rem;
    font-weight: 700;
    display: block;
    margin-bottom: 0.5rem;
}

.help-text p {
    color: #4a5568;
    font-size: 0.975rem;
    line-height: 1.5;
    margin: 0;
}

.help-steps {
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    border-left: 4px solid #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.help-steps li {
    color: #4a5568;
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.help-steps li:last-child {
    margin-bottom: 0;
}

.help-steps strong {
    color: #2d3748;
    font-weight: 700;
}

.help-footer {
    background: linear-gradient(135deg, #fef5e7 0%, #fed7aa 100%);
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid #fbbf24;
}

.help-footer p {
    margin: 0;
    color: #92400e;
    font-weight: 600;
    text-align: center;
}

/* Theme support */
body.theme .help-panel {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border-color: rgba(74, 85, 104, 0.5);
}

body.theme .help-section h4,
body.theme .help-text strong,
body.theme .help-steps strong {
    color: #e2e8f0;
}

body.theme .help-section p,
body.theme .help-text p,
body.theme .help-steps li {
    color: #cbd5e0;
}

body.theme .help-item {
    background: rgba(45, 55, 72, 0.8);
    border-color: rgba(74, 85, 104, 0.3);
}

body.theme .help-steps {
    background: rgba(45, 55, 72, 0.8);
    border-left-color: #667eea;
}

body.theme .help-footer {
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    border-color: #667eea;
}

body.theme .help-footer p {
    color: #e2e8f0;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Theme toggle */
.theme-toggle {
    background: #4a5568;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(74, 85, 104, 0.3);
}

.theme-toggle.fixed-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 1.1em;
    backdrop-filter: blur(10px);
    background: rgba(74, 85, 104, 0.9);
    border: 1px solid rgba(107, 114, 128, 0.5);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.theme-toggle:hover {
    background: #2d3748;
    transform: translateY(-1px);
}

.theme-toggle.fixed-toggle:hover {
    background: rgba(45, 55, 72, 0.95);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}


/* Player names widget */
.player-names-widget {
    position: relative;
}

.names-toggle {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.names-toggle:hover {
    background: #5a67d8;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
}

.names-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    padding: 12px;
    min-width: 200px;
    z-index: 1000;
    border: 1px solid #e2e8f0;
}

.names-compact-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.names-compact-grid input {
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 0.85em;
    color: #2d3748;
    transition: border-color 0.2s ease;
}

.names-compact-grid input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.names-compact-grid input::placeholder {
    color: #a0aec0;
    font-size: 0.8em;
}

/* Date input in header */
.date-input {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.date-input:hover {
    background: #5a67d8;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
}

.date-input:focus {
    outline: none;
    background: #5a67d8;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* Date input color scheme for webkit browsers */
.date-input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

.input-section {
    background: #f7fafc;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
    justify-content: center;
}

/* Ensure buttons maintain their HTML order */
.action-buttons button,
.action-buttons .restore-btn,
.action-buttons .toggle-date-btn {
    order: initial !important;
}

.input-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.input-field {
    display: flex;
    flex-direction: column;
}

.toggle-section {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    max-width: 100%;
    padding: 0 10px;
}

.race-history {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
}

#history-heading {
    margin-bottom: 20px;
    color: #1f2937;
    font-weight: 600;
}

/* Date filter section */
.date-filter-section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.date-filter-section h3 {
    color: #4a5568;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.1em;
}

.date-filter-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.custom-date-range {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.custom-date-range input {
    padding: 6px 10px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9em;
}

.custom-date-range input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
}

/* Firefox-specific cursor fix for date inputs */
@-moz-document url-prefix() {
    input[type="date"] {
        cursor: pointer !important;
    }
    
    .date-input,
    .custom-date-range input[type="date"],
    .race-date-input {
        cursor: pointer !important;
    }
}

.custom-date-range span {
    color: white !important;
    font-size: 0.975rem;
    font-weight: 500;
}

.custom-date-range button {
    padding: 6px 12px;
    background: #667eea;
    color: white !important;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
}

/* Player count selector styling */
.player-count-selector {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e7eb;
}

.player-count-selector label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #000000 !important;
}

.player-count-selector select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    color: #374151;
}

/* Dynamic grid layouts for different player counts */
.input-group.players-1 {
    grid-template-columns: 1fr;
    max-width: 400px;
    margin: 0 auto;
}

.input-group.players-2 {
    grid-template-columns: repeat(2, 1fr);
}

.input-group.players-3 {
    grid-template-columns: repeat(3, 1fr);
}

.input-group.players-4 {
    grid-template-columns: repeat(2, 1fr);
}


/* Theme toggle moved to sidebar */

@media (min-width: 1200px) {
    .input-group.players-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}
