/* wheel-of-fortune.css */
:root {
    --wof-primary: #4f46e5;
    --wof-success: #22c55e;
    --wof-warning: #f59e0b;
    --wof-danger: #ef4444;
    --wof-bg: #ffffff;
    --wof-border: #e2e8f0;
    --wof-text: #0f172a;
    --wof-text-light: #64748b;
}

.wof-container {
    padding: var(--spacing-lg) 0 var(--spacing-2xl);
}

.wof-grid {
    display: grid;
    grid-template-columns: 360px 445px 320px;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-xl);
    justify-content: center;
}

/* Общие стили секций */
.wof-settings-panel,
.wof-wheel-panel,
.wof-history-panel {
    background: var(--white);
    border-radius: var(--border-radius-xl);
    border: 1px solid var(--wof-border);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
}

.wof-section {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--wof-border);
}

.wof-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.wof-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--wof-text);
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.wof-section-title ion-icon {
    color: var(--wof-primary);
    font-size: 1.2rem;
}

/* Форма добавления приза */
.add-prize-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.form-group {
    width: 100%;
}

.form-group input[type="text"],
.form-group input[type="number"] {
    width: 100%;
    padding: 0.625rem 1rem;
    border: 1px solid var(--wof-border);
    border-radius: var(--border-radius-md);
    font-family: var(--font-primary);
    font-size: 0.9375rem;
    transition: var(--transition);
    box-sizing: border-box;
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus {
    outline: none;
    border-color: var(--wof-primary);
    box-shadow: var(--shadow-glow);
}

.form-group input[type="color"] {
    width: 50px;
    height: 42px;
    padding: 4px;
    border: 1px solid var(--wof-border);
    border-radius: var(--border-radius-md);
    cursor: pointer;
}

.form-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.flex-grow {
    flex: 1;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--wof-text-light);
    margin-top: 6px;
}

/* Стили для переключателей (switch) */
.switch-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    cursor: pointer;
    transition: var(--transition);
    border-radius: var(--border-radius-md);
}

.switch-label:hover {
    background: var(--gray-50);
    padding: 12px 12px;
    margin: 0 -12px;
}

.switch-info {
    flex: 1;
}

.label-title {
    font-weight: 600;
    color: var(--wof-text);
    display: block;
    margin-bottom: 4px;
    font-size: 0.9375rem;
}

.label-description {
    font-size: 0.75rem;
    color: var(--wof-text-light);
    display: block;
}

.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-300);
    transition: var(--transition);
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
}

input:checked + .slider {
    background: linear-gradient(135deg, var(--wof-primary), var(--primary-500));
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* Группа настроек */
.settings-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.input-group {
    margin-top: 12px;
}

.input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--wof-text);
    margin-bottom: 8px;
}

.input-group input[type="range"] {
    width: calc(100% - 60px);
    height: 6px;
    background: var(--gray-200);
    border-radius: var(--border-radius-full);
    -webkit-appearance: none;
    vertical-align: middle;
}

.input-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--wof-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    border: 2px solid white;
}

.input-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--wof-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    border: 2px solid white;
}

#duration-value {
    display: inline-block;
    margin-left: 10px;
    font-size: 0.875rem;
    color: var(--wof-text-light);
    min-width: 45px;
}

/* Список призов */
.prizes-list {
    max-height: 320px;
    overflow-y: auto;
    margin-bottom: var(--spacing-md);
}

.empty-prizes {
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-md);
    color: var(--wof-text-light);
}

.empty-prizes ion-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-sm);
    opacity: 0.5;
}

.prize-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--gray-50);
    border-radius: var(--border-radius-lg);
    margin-bottom: 8px;
    transition: var(--transition);
    border: 1px solid transparent;
}

.prize-item:hover {
    background: var(--white);
    border-color: var(--wof-border);
    box-shadow: var(--shadow-sm);
}

.prize-color {
    width: 28px;
    height: 28px;
    border-radius: var(--border-radius-full);
    border: 2px solid var(--white);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.prize-info {
    flex: 1;
    min-width: 0;
}

.prize-name {
    font-weight: 500;
    color: var(--wof-text);
    display: block;
    font-size: 0.9375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prize-weight {
    font-size: 0.7rem;
    color: var(--wof-text-light);
    display: block;
}

.prize-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.prize-actions button {
    background: none;
    border: none;
    color: var(--wof-text-light);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--border-radius-full);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.prize-actions button:hover {
    background: var(--white);
}

.prize-actions button ion-icon {
    font-size: 1.1rem;
}

.edit-prize:hover {
    color: var(--wof-primary) !important;
}

.delete-prize:hover {
    color: var(--wof-danger) !important;
}

.prize-count {
    margin-left: auto;
    background: var(--gray-100);
    padding: 2px 10px;
    border-radius: var(--border-radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--wof-text-light);
}

.prizes-actions {
    display: flex;
    gap: 10px;
    margin-top: var(--spacing-md);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    flex: 1;
    justify-content: center;
}

/* Колесо */
.wof-wheel-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wheel-container {
    position: relative;
    width: 380px;
    height: 380px;
    margin: 0 auto var(--spacing-lg);
}

#wheelCanvas {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50%;
    box-shadow: var(--shadow-xl);
}

.wheel-pointer {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    width: 45px;
    height: 45px;
    background: var(--wof-text);
    border-radius: var(--border-radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.4rem;
    box-shadow: var(--shadow-lg);
    z-index: 10;
    border: 3px solid var(--white);
}

.wheel-pointer ion-icon {
    transform: rotate(0deg);
    font-size: 1.6rem;
}

.wheel-actions {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    width: 100%;
    justify-content: center;
}

#spin-wheel {
    min-width: 180px;
}

#spin-wheel:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-large {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

/* Результат */
.last-result {
    width: 100%;
    padding: var(--spacing-md);
    background: linear-gradient(135deg, var(--wof-primary), var(--primary-700));
    border-radius: var(--border-radius-lg);
    text-align: center;
    animation: slideUp 0.5s ease;
    margin-top: var(--spacing-md);
}

.result-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: white;
}

.result-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

.result-value {
    font-size: 1.3rem;
    font-weight: 700;
}

/* История */
.wof-history-panel {
    display: flex;
    flex-direction: column;
}

.history-list {
    flex: 1;
    max-height: 420px;
    overflow-y: auto;
    margin-bottom: var(--spacing-md);
}

.history-item {
    padding: 10px 12px;
    background: var(--gray-50);
    border-radius: 5px;
    margin-bottom: 8px;
    animation: slideIn 0.3s ease;
}

.history-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.history-prize {
    font-weight: 500;
    color: var(--wof-text);
    font-size: 0.9375rem;
    word-break: break-word;
}

.history-time {
    font-size: 0.7rem;
    color: var(--wof-text-light);
    white-space: nowrap;
}

.history-stats {
    padding: var(--spacing-md);
    background: var(--gray-50);
    border-radius: var(--border-radius-lg);
    font-size: 0.875rem;
    color: var(--wof-text-light);
    line-height: 1.6;
}

.history-stats strong {
    color: var(--wof-text);
    display: block;
    margin-bottom: 6px;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--wof-text-light);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--border-radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    margin-left: auto;
}

.btn-icon:hover {
    color: var(--wof-danger);
    background: var(--gray-100);
}

.btn-icon ion-icon {
    font-size: 1.2rem;
}

/* Кнопки */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: var(--border-radius-full);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: linear-gradient(135deg, var(--wof-primary), var(--primary-700));
    color: var(--white);
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-700), var(--primary-800));
    transform: translateY(-1px);
    box-shadow: 0 6px 10px -1px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover ion-icon {
    transform: rotate(180deg);
}

.btn-outline {
    background: transparent;
    border-color: var(--wof-border);
    color: var(--wof-text);
}

.btn-outline:hover {
    border-color: var(--wof-primary);
    background: var(--primary-50);
    color: var(--wof-primary);
}

/* Анимации */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Режим редактирования */
.prize-item.editing {
    background: var(--white);
    border: 2px solid var(--wof-primary);
    padding: 8px 12px;
}

.edit-form {
    display: flex;
    gap: 8px;
    width: 100%;
}

.edit-form input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--wof-border);
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-family: var(--font-primary);
}

.edit-form input:focus {
    outline: none;
    border-color: var(--wof-primary);
    box-shadow: var(--shadow-glow);
}

.edit-form button {
    padding: 6px 12px;
    background: var(--wof-primary);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: 500;
}

.edit-form button:hover {
    background: var(--primary-700);
}

/* Адаптивность */
@media (max-width: 1300px) {
    .wof-grid {
        grid-template-columns: 340px 380px 340px;
        gap: var(--spacing-md);
    }
    
    .wheel-container {
        width: 340px;
        height: 340px;
    }
}

@media (max-width: 1150px) {
    .wof-grid {
        grid-template-columns: 1fr;
        max-width: 550px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .wof-wheel-panel {
        order: -1;
    }
    
    .wof-settings-panel {
        order: 1;
    }
    
    .wof-history-panel {
        order: 2;
    }
    
    .wheel-container {
        width: 400px;
        height: 400px;
    }
}

@media (max-width: 768px) {
    .wof-settings-panel,
    .wof-wheel-panel,
    .wof-history-panel {
        padding: var(--spacing-md);
    }
    
    .wheel-container {
        width: 280px;
        height: 280px;
    }
    
    .wheel-pointer {
        width: 38px;
        height: 38px;
        top: -14px;
    }
    
    .wheel-pointer ion-icon {
        font-size: 1.3rem;
    }
    
    .wheel-actions {
        flex-direction: column;
        align-items: center;
    }
    
    #spin-wheel {
        min-width: auto;
        width: 100%;
    }
    
    .btn-large {
        width: 100%;
    }
    
    .history-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .history-time {
        align-self: flex-end;
    }
    
    .prizes-actions {
        flex-direction: column;
    }
    
    .prizes-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .form-row {
        flex-wrap: wrap;
    }
    
    .form-group input[type="color"] {
        width: 100%;
    }
    
    .form-row .btn-primary {
        width: 100%;
    }
    
    .wheel-container {
        width: 250px;
        height: 250px;
    }
    
    .wheel-pointer {
        width: 34px;
        height: 34px;
        top: -12px;
    }
    
    .wheel-pointer ion-icon {
        font-size: 1.1rem;
    }
    
    .result-value {
        font-size: 1rem;
    }
    
    .result-badge {
        flex-wrap: wrap;
    }
}

/* Скроллбар */
.prizes-list::-webkit-scrollbar,
.history-list::-webkit-scrollbar {
    width: 6px;
}

.prizes-list::-webkit-scrollbar-track,
.history-list::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: var(--border-radius-full);
}

.prizes-list::-webkit-scrollbar-thumb,
.history-list::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: var(--border-radius-full);
}

.prizes-list::-webkit-scrollbar-thumb:hover,
.history-list::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}