/* Configuration Page Styles - Updated for New Design System */

body {
    margin: 0;
    padding: 0;
    background: #2a2a2a;
    color: white;
    font-family: Arial, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto; /* Enable vertical scrolling */
}

.config-page {
    padding: 20px;
    max-width: 1000px;
    margin: 0 auto;
    background: #2a2a2a;
    min-height: 100vh;
    /* Remove the calc() that was limiting height */
    padding-bottom: 60px; /* Add extra bottom padding for better scrolling */
}

.config-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #666;
}

.config-header h1 {
    color: #4a90e2;
    margin: 0 0 15px 0;
    font-size: 28px;
}

.config-header p {
    color: #ccc;
    margin: 0;
    font-size: 16px;
}

.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .config-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

.config-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 25px;
    border: 1px solid #666;
    backdrop-filter: blur(5px);
}

.config-section h3 {
    color: #4a90e2;
    margin: 0 0 20px 0;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.config-section .icon {
    font-size: 22px;
}

.config-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid #555;
}

.config-row:last-child {
    margin-bottom: 0;
}

.config-row label {
    font-weight: bold;
    min-width: 140px;
    color: #fff;
    font-size: 14px;
}

.config-row .description {
    font-size: 12px;
    color: #aaa;
    margin-top: 4px;
    line-height: 1.3;
}

.config-input-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.config-input-group input[type="range"] {
    width: 120px;
    height: 6px;
    background: #555;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.config-input-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #4a90e2;
    border-radius: 50%;
    cursor: pointer;
}

.config-input-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #4a90e2;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.config-input-group input[type="number"] {
    width: 70px;
    padding: 6px 10px;
    background: #444;
    color: white;
    border: 1px solid #666;
    border-radius: 6px;
    font-size: 12px;
    text-align: center;
}

.config-input-group input[type="text"] {
    width: 90px;
    padding: 6px 10px;
    background: #444;
    color: white;
    border: 1px solid #666;
    border-radius: 6px;
    font-size: 12px;
    text-align: center;
}

.config-input-group input[type="color"] {
    width: 45px;
    height: 35px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
}

.config-input-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #4a90e2;
}

.config-input-group span {
    font-size: 12px;
    color: #4a90e2;
    font-weight: bold;
    min-width: 30px;
}

.config-input-group button {
    padding: 8px 16px;
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.2s ease;
}

.config-input-group button:hover {
    background: #357abd;
    transform: translateY(-1px);
}

.back-link {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(74, 144, 226, 0.9);
    color: white;
    text-decoration: none;
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.back-link:hover {
    background: rgba(53, 122, 189, 0.9);
    transform: translateY(-1px);
}

.preview-area {
    background: #1a1a1a;
    border: 1px solid #666;
    border-radius: 8px;
    padding: 20px;
    margin-top: 15px;
    text-align: center;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid-preview {
    width: 120px;
    height: 120px;
    background: #333;
    border-radius: 8px;
    position: relative;
    margin: 0 auto;
}

/* Player/Token section styles */
.player-section {
    grid-column: 1 / -1; /* Full width */
    margin-bottom: 30px;
}

.player-entry {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid #555;
    transition: all 0.2s ease;
}

.player-entry:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: #4a90e2;
}

.player-number {
    font-weight: bold;
    color: #4a90e2;
    width: 35px;
    height: 35px;
    background: rgba(74, 144, 226, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.player-inputs {
    display: flex;
    gap: 20px;
    flex: 1;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.input-group label {
    font-size: 12px;
    color: #aaa;
    margin: 0;
    font-weight: normal;
}

.input-group input {
    background: #444;
    border: 1px solid #666;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.input-group input:focus {
    border-color: #4a90e2;
    outline: none;
}

.token-color-circle {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 3px solid white;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.token-color-circle:hover {
    transform: scale(1.1);
}

.player-controls {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn-small {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: bold;
}

.secondary-button {
    background: #666;
    color: white;
}

.secondary-button:hover {
    background: #555;
}

.danger-button {
    background: #ff4444;
    color: white;
}

.danger-button:hover {
    background: #cc3333;
}

.success-button {
    background: #44aa44;
    color: white;
}

.success-button:hover {
    background: #339933;
}

.debug-button {
    background: #ff8800;
    color: white;
}

.debug-button:hover {
    background: #cc6600;
}

.add-player-btn {
    display: block;
    width: 100%;
    margin-top: 20px;
    padding: 15px;
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s ease;
}

.add-player-btn:hover {
    background: #357abd;
    transform: translateY(-1px);
}

.config-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 30px 0;
    border-top: 1px solid #666;
    flex-wrap: wrap;
}

.config-actions button {
    padding: 15px 25px;
    font-size: 14px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
    min-width: 140px;
}

.config-actions button:hover {
    transform: translateY(-1px);
}

/* Ensure token previews are perfect circles */
#tokenPreview div > div {
    aspect-ratio: 1 / 1 !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
}

/* Notification styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: bold;
    z-index: 1000;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.notification-success {
    background: rgba(68, 170, 68, 0.9);
}

.notification-error {
    background: rgba(244, 67, 54, 0.9);
}

.notification-info {
    background: rgba(33, 150, 243, 0.9);
}

.notification-warning {
    background: rgba(255, 152, 0, 0.9);
}

/* Custom scrollbar styling for webkit browsers */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb {
    background: #4a90e2;
    border-radius: 6px;
    border: 2px solid #1a1a1a;
}

::-webkit-scrollbar-thumb:hover {
    background: #357abd;
}

/* Firefox scrollbar styling */
* {
    scrollbar-width: thin;
    scrollbar-color: #4a90e2 #1a1a1a;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .config-page {
        padding: 15px;
    }
    
    .config-header h1 {
        font-size: 24px;
    }
    
    .config-section {
        padding: 20px;
    }
    
    .config-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .config-input-group {
        width: 100%;
        justify-content: flex-end;
    }
    
    .player-inputs {
        flex-direction: column;
        gap: 15px;
    }
    
    .player-controls {
        margin-top: 10px;
    }
    
    .config-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .config-actions button {
        width: 100%;
        max-width: 300px;
    }
    
    .back-link {
        position: relative;
        top: auto;
        left: auto;
        display: inline-block;
        margin-bottom: 20px;
        position: static; /* Remove fixed positioning on mobile */
    }
    
    .config-header {
        margin-top: 20px; /* Reduce top margin on mobile since back button is not fixed */
    }
}

/* Sync Settings Styles */
.config-input-group select {
    width: 150px;
    padding: 8px 12px;
    background: #444;
    color: white;
    border: 1px solid #666;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.config-input-group select:focus {
    border-color: #4a90e2;
    outline: none;
}

.config-input-group select option {
    background: #444;
    color: white;
    padding: 5px;
}

/* Sync Preview Animation */
@keyframes syncPulse {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(74, 144, 226, 0.7);
    }
    50% { 
        opacity: 0.7; 
        transform: scale(1.1);
        box-shadow: 0 0 0 8px rgba(74, 144, 226, 0);
    }
}

/* Sync Speed Indicators */
.sync-speed-ultra-fast {
    animation: syncPulse 0.5s infinite;
}

.sync-speed-very-fast {
    animation: syncPulse 0.8s infinite;
}

.sync-speed-fast {
    animation: syncPulse 1.2s infinite;
}

.sync-speed-normal {
    animation: syncPulse 2s infinite;
}

.sync-speed-slow {
    animation: syncPulse 3s infinite;
}

.sync-speed-very-slow {
    animation: syncPulse 5s infinite;
}

/* Real-time Sync Section Styling */
.config-section h3 .icon {
    display: inline-block;
    margin-right: 8px;
}

#syncPreview {
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#syncSpeedText {
    font-size: 14px;
    font-weight: bold;
}

#syncIntervalText {
    color: #4a90e2;
    font-weight: bold;
}

/* Enhanced dropdown styling */
.config-input-group select:hover {
    border-color: #4a90e2;
    background: #4a4a4a;
}

/* Performance indicators */
.performance-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 8px;
}

.performance-indicator.excellent {
    background: #4CAF50;
    box-shadow: 0 0 4px #4CAF50;
}

.performance-indicator.good {
    background: #8BC34A;
    box-shadow: 0 0 4px #8BC34A;
}

.performance-indicator.fair {
    background: #FFC107;
    box-shadow: 0 0 4px #FFC107;
}

.performance-indicator.poor {
    background: #FF9800;
    box-shadow: 0 0 4px #FF9800;
}

.performance-indicator.very-poor {
    background: #F44336;
    box-shadow: 0 0 4px #F44336;
}

/* Responsive adjustments for sync settings */
@media (max-width: 768px) {
    .config-input-group select {
        width: 100%;
        max-width: 200px;
    }
    
    #syncPreview {
        padding: 15px;
    }
    
    #syncPreview > div {
        flex-direction: column;
        gap: 10px;
    }
}