/* TU Notifications Preferences */

:root {
    --tun-primary: #ca4f2e;
    --tun-primary-hover: #b04528;
    --tun-select: #52B5CA;
    --tun-select-light: rgba(82, 181, 202, 0.1);
    --tun-text: #111827;
    --tun-text-secondary: #4b5563;
    --tun-text-muted: #6b7280;
    --tun-border: #d1d5db;
    --tun-border-light: #e5e7eb;
    --tun-bg: #ffffff;
    --tun-bg-alt: #f3f4f6;
    --tun-success: #047857;
    --tun-success-bg: #d1fae5;
    --tun-warning: #92400e;
    --tun-warning-bg: #fef3c7;
}

/* Container */
.tun-preferences {
    max-width: 700px;
    margin: 0 auto;
    padding: 0 20px 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    color: var(--tun-text);
    line-height: 1.5;
}

@media (max-width: 600px) {
    .tun-preferences {
        padding: 0 16px 16px;
    }
}

/* Loading */
.tun-preferences__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px 20px;
    color: var(--tun-text-muted);
    font-size: 14px;
}

.tun-preferences__loading-spinner {
    width: 28px;
    height: 28px;
    border: 2px solid var(--tun-border);
    border-top-color: var(--tun-primary);
    border-radius: 50%;
    animation: tunSpin 0.7s linear infinite;
    margin-bottom: 12px;
}

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

/* Error */
.tun-error {
    text-align: center;
    padding: 60px 20px;
    color: var(--tun-text-muted);
    font-size: 14px;
}

/* Status Banner */
.tun-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 24px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 17px;
    font-weight: 600;
    min-height: 62px;
    box-sizing: border-box;
}

.tun-status--active {
    background: #d1fae5;
    color: #047857;
}

.tun-status--inactive {
    background: var(--tun-warning-bg);
    color: var(--tun-warning);
}

.tun-status__icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    display: block;
}

.tun-status__text {
    flex: 1;
}

.tun-status__btn {
    padding: 12px 18px;
    background: var(--tun-primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.tun-status__btn:hover {
    background: var(--tun-primary-hover);
}

/* Card */
.tun-card {
    background: var(--tun-bg);
    border: 1px solid var(--tun-border);
    border-radius: 12px;
    overflow: hidden;
}

/* Tabs */
.tun-tabs {
    display: flex;
    border-bottom: 1px solid var(--tun-border-light);
}

.tun-tab {
    flex: 1;
    padding: 14px 16px;
    background: var(--tun-bg-alt);
    border: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--tun-text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}

.tun-tab:first-child {
    border-right: 1px solid var(--tun-border-light);
}

.tun-tab:hover {
    color: var(--tun-text);
}

.tun-tab.is-active {
    background: var(--tun-select);
    color: white;
}

.tun-tab.is-active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--tun-select);
}

/* Tab Content */
.tun-tab-content {
    display: none;
    padding: 20px;
}

.tun-tab-content.is-active {
    display: block;
}

/* Tab Intro */
.tun-tab-intro {
    margin-bottom: 20px;
    padding-left: 16px;
}

.tun-tab-intro__title {
    font-size: 17px;
    font-weight: 700;
    color: var(--tun-text);
    margin: 0 0 6px;
}

.tun-tab-intro__text {
    font-size: 14px;
    color: var(--tun-text-secondary);
    line-height: 1.5;
    margin: 0;
}

/* Section Title */
.tun-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--tun-text);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin: 0 0 12px;
    padding-left: 16px;
}

.tun-section-title:not(:first-child) {
    margin-top: 24px;
}

/* Toggle Item */
.tun-toggle-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 20px;
    background: var(--tun-bg-alt);
    border: 2px solid var(--tun-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    width: 100%;
    text-align: left;
}

.tun-toggle-item:hover {
    border-color: #d1d5db;
}

.tun-toggle-item.is-checked {
    background: var(--tun-select-light);
    border-color: var(--tun-select);
}

.tun-toggle-item__check {
    width: 22px;
    height: 22px;
    border: 2px solid var(--tun-border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
    background: var(--tun-bg);
    margin-top: 1px;
}

.tun-toggle-item.is-checked .tun-toggle-item__check {
    background: var(--tun-select);
    border-color: var(--tun-select);
}

.tun-toggle-item__check svg {
    width: 14px;
    height: 14px;
    stroke: white;
    stroke-width: 3;
    opacity: 0;
    display: block;
}

.tun-toggle-item.is-checked .tun-toggle-item__check svg {
    opacity: 1;
}

.tun-toggle-item__label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--tun-text);
}

.tun-toggle-item__hint {
    display: block;
    font-size: 13px;
    color: var(--tun-text-secondary);
    margin-top: 2px;
}

/* Players Grid */
.tun-players {
    display: none;
    margin-top: 16px;
}

.tun-players.is-visible {
    display: block;
}

.tun-players__section {
    margin-bottom: 16px;
}

.tun-players__section:last-child {
    margin-bottom: 0;
}

.tun-players__label {
    font-size: 11px;
    font-weight: 700;
    color: var(--tun-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding-left: 16px;
}

.tun-players__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

@media (max-width: 480px) {
    .tun-players__grid {
        grid-template-columns: 1fr;
    }
}

/* Player Item */
.tun-player-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--tun-bg);
    border: 1px solid var(--tun-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    width: 100%;
    text-align: left;
}

.tun-player-item:hover {
    border-color: #d1d5db;
    background: var(--tun-bg-alt);
}

.tun-player-item.is-checked {
    background: var(--tun-select-light);
    border-color: var(--tun-select);
}

.tun-player-item__check {
    width: 18px;
    height: 18px;
    border: 2px solid var(--tun-border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
    background: var(--tun-bg);
}

.tun-player-item.is-checked .tun-player-item__check {
    background: var(--tun-select);
    border-color: var(--tun-select);
}

.tun-player-item__check svg {
    width: 12px;
    height: 12px;
    stroke: white;
    stroke-width: 3;
    opacity: 0;
    display: block;
}

.tun-player-item.is-checked .tun-player-item__check svg {
    opacity: 1;
}

.tun-player-item__name {
    font-size: 14px;
    font-weight: 500;
    color: var(--tun-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Radio Group */
.tun-radios {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tun-radio-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--tun-bg-alt);
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    width: 100%;
    text-align: left;
}

.tun-radio-item:hover {
    background: #e5e7eb;
}

.tun-radio-item.is-checked {
    background: var(--tun-bg-alt);
    border-color: var(--tun-select);
}

.tun-radio-item__circle {
    width: 20px;
    height: 20px;
    border: 2px solid var(--tun-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
    background: var(--tun-bg);
    position: relative;
}

.tun-radio-item.is-checked .tun-radio-item__circle {
    border-color: var(--tun-select);
}

.tun-radio-item__circle::after {
    content: '';
    width: 10px;
    height: 10px;
    background: var(--tun-select);
    border-radius: 50%;
    opacity: 0;
    transform: scale(0);
    transition: all 0.15s;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -5px;
    margin-left: -5px;
}

.tun-radio-item.is-checked .tun-radio-item__circle::after {
    opacity: 1;
    transform: scale(1);
}

.tun-radio-item__label {
    font-size: 15px;
    font-weight: 500;
    color: var(--tun-text);
}

/* Card Footer */
.tun-card__footer {
    padding: 20px;
    background: var(--tun-bg-alt);
    border-top: 1px solid var(--tun-border);
}

/* Button */
.tun-btn {
    display: block;
    width: 100%;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
    text-align: center;
}

.tun-btn--primary {
    background: var(--tun-select);
    color: white;
}

.tun-btn--primary:hover {
    background: #469aa8;
}

/* Button States */
.tun-btn--saving {
    pointer-events: none;
    opacity: 0.8;
}

.tun-btn--saving .tun-btn__text {
    visibility: hidden;
}

.tun-btn--saving::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: tunSpin 0.7s linear infinite;
}

.tun-btn--success {
    background: var(--tun-success) !important;
}

.tun-btn--error {
    background: #dc2626 !important;
}

.tun-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Utility */
.tun-hidden {
    display: none !important;
}
