/**
 * Elder Spores Online - Settings Module Styles
 * Handles settings modal and related UI components
 * 
 * @version 1.0.0
 * @created 2025-12-09
 */

/* ========================================
   SETTINGS HEADER CONTAINER
   ======================================== */

.settings-header-container {
    display: flex;
    align-items: center;
    gap: 12px;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
}

/* ========================================
   SETTINGS BUTTON (Cogwheel)
   ======================================== */

.settings-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-btn:hover {
    background: rgba(255, 215, 0, 0.15);
    border-color: rgba(255, 215, 0, 0.5);
    transform: rotate(45deg);
}

.settings-btn:hover .settings-icon {
    color: var(--color-primary, #ffd700);
}

.settings-icon {
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.2s ease;
}

/* ========================================
   USER HEADER DISPLAY
   ======================================== */

.user-header-display {
    display: flex;
    align-items: center;
}

.user-mini-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-mini-profile:hover {
    background: rgba(255, 215, 0, 0.1);
    border-color: rgba(255, 215, 0, 0.4);
}

.user-mini-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(255, 215, 0, 0.5);
}

.user-mini-name {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    font-weight: 500;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-mini-tier {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.user-mini-tier.tier-free {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
}

.user-mini-tier.tier-basic {
    background: rgba(76, 175, 80, 0.2);
    color: #81c784;
}

.user-mini-tier.tier-premium {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
}

.user-mini-tier.tier-lifetime {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 107, 107, 0.3));
    color: #ffd700;
    border: 1px solid rgba(255, 215, 0, 0.5);
}

/* Login Header Button (Guest State) */
.login-header-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(88, 101, 242, 0.2);
    border: 1px solid rgba(88, 101, 242, 0.4);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.login-header-btn:hover {
    background: rgba(88, 101, 242, 0.35);
    border-color: rgba(88, 101, 242, 0.6);
}

.login-header-btn svg {
    opacity: 0.8;
}

/* ========================================
   SETTINGS MODAL OVERLAY
   ======================================== */

.settings-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.settings-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   SETTINGS MODAL CONTAINER
   ======================================== */

.settings-modal {
    
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 22px;
    box-shadow: 0 0 15px var(--color-primary, #ffd700);
    max-width: 560px;
    width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.settings-modal-overlay.active .settings-modal {
    transform: translateY(0);
}

/* ========================================
   MODAL HEADER
   ======================================== */

.settings-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(to right, var(--color-secondary), #2a2a2a);
    border-bottom: 1px solid rgba(255, 215, 0, 0.15);
    border-radius: 20px 20px 0 0;
}

.settings-modal-header h2 {
    color: var(--color-primary, #ffd700);
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.settings-close-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.settings-close-btn:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.1);
}

/* ========================================
   MODAL BODY
   ======================================== */

.settings-modal-body {
    background: linear-gradient(to bottom, var(--color-background, #1a1a2e) 25%, var(--color-secondary, #16213e));
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Settings Section */
.settings-section {
    margin-bottom: 28px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section-title {
    color: var(--color-primary, #ffd700);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 16px 0;
    padding-bottom: 8px;
}

/* Profile Card */
.settings-profile-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    margin-bottom: 20px;
}

.settings-avatar {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    border: 3px solid rgba(255, 215, 0, 0.5);
}

.settings-profile-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-username {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    font-weight: 600;
}

.settings-tier-badge {
    display: inline-block;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    width: fit-content;
}

.settings-tier-badge.tier-free {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
}

.settings-tier-badge.tier-basic {
    background: rgba(76, 175, 80, 0.2);
    color: #81c784;
}

.settings-tier-badge.tier-premium {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
}

.settings-tier-badge.tier-lifetime {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 107, 107, 0.3));
    color: #ffd700;
    border: 1px solid rgba(255, 215, 0, 0.5);
}

/* Subscription Button */
.settings-subscription-btn {
    margin-left: auto;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 25px;
    transition: all 0.2s ease;
}

.settings-subscription-btn:hover {
    box-shadow: 0 0 10px #ff8800;
}

.settings-subscription-btn img {
    height: 74px;
    width: auto;
    display: block;
}
/* ========================================
   FORM FIELDS
   ======================================== */

.settings-field {
    margin-bottom: 16px;
}

.settings-field:last-child {
    margin-bottom: 0;
}

.settings-field label {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    margin-bottom: 6px;
}

.settings-field input[type="text"],
.settings-field input[type="url"],
.settings-field textarea,
.settings-field select {
    width: 100%;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.settings-field input[type="text"]:focus,
.settings-field input[type="url"]:focus,
.settings-field textarea:focus,
.settings-field select:focus {
    outline: none;
    border-color: rgba(255, 215, 0, 0.5);
    background: rgba(0, 0, 0, 0.4);
}

.settings-field textarea {
    resize: vertical;
    min-height: 80px;
}

.settings-field select {
    cursor: pointer;
}

.settings-field select option {
    background: #1a1a2e;
    color: rgba(255, 255, 255, 0.9);
}

.settings-field-hint {
    display: block;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
    margin-top: 4px;
}

/* ========================================
   SLIDER FIELD
   ======================================== */

.settings-slider-container {
    display: flex;
    align-items: center;
    gap: 16px;
}

.settings-slider-container input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    cursor: pointer;
}

.settings-slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--color-primary, #ffd700);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.settings-slider-container input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.settings-slider-value {
    min-width: 32px;
    text-align: center;
    color: var(--color-primary, #ffd700);
    font-weight: 600;
    font-size: 1rem;
}

/* ========================================
   TOGGLE FIELD
   ======================================== */

.settings-toggle-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-toggle-field > label:first-child {
    margin-bottom: 0;
}

.settings-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.settings-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.settings-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 26px;
    transition: background 0.3s ease;
}

.settings-toggle-slider::before {
    position: absolute;
    content: '';
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    transition: transform 0.3s ease, background 0.3s ease;
}

.settings-toggle input:checked + .settings-toggle-slider {
    background: rgba(255, 215, 0, 0.4);
}

.settings-toggle input:checked + .settings-toggle-slider::before {
    transform: translateX(22px);
    background: var(--color-primary, #ffd700);
}

/* Cache Status in Settings */
.settings-cache-field {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-cache-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-top: 8px;
}

.cache-size-text {
    font-size: 14px;
    font-weight: 500;
}

.cache-size-text.cache-ok {
    color: #4ade80; /* Green */
}

.cache-size-text.cache-critical {
    color: #ef4444; /* Red */
}

.settings-clear-cache-btn {
    padding: 6px 12px;
    background: linear-gradient(135deg, #b8860b, #daa520);
    border: 1px solid #daa520;
    border-radius: 4px;
    color: #1a1a2e;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-clear-cache-btn:hover {
    background: linear-gradient(135deg, #daa520, #ffd700);
    transform: translateY(-1px);
}

.settings-clear-cache-btn.cache-btn-critical {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    border-color: #ef4444;
    color: white;
}

.settings-clear-cache-btn.cache-btn-critical:hover {
    background: linear-gradient(135deg, #ef4444, #f87171);
}

/* ========================================
   GUEST SECTION
   ======================================== */

.settings-guest-message {
    text-align: center;
    padding: 40px 20px;
}

.settings-guest-message svg {
    color: rgba(255, 255, 255, 0.3);
    margin-bottom: 16px;
}

.settings-guest-message h3 {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.2rem;
    margin: 0 0 8px 0;
}

.settings-guest-message p {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    margin: 0 0 24px 0;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.settings-guest-message .discord-login-btn {
    display: inline-flex;
}

/* ========================================
   MODAL FOOTER
   ======================================== */

.settings-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 215, 0, 0.15);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 0 14px 14px;
}

.settings-footer-left,
.settings-footer-right {
    display: flex;
    gap: 12px;
}

.settings-logout-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: rgba(220, 53, 69, 0.15);
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-radius: 8px;
    color: #ff6b7a;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-logout-btn:hover {
    background: rgba(220, 53, 69, 0.25);
    border-color: rgba(220, 53, 69, 0.5);
}

.settings-cancel-btn {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-cancel-btn:hover {
    border-color: rgba(255, 255, 255, 0.4);
    color: rgba(255, 255, 255, 0.9);
}

.settings-save-btn {
    padding: 10px 24px;
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid rgba(255, 215, 0, 0.4);
    border-radius: 8px;
    color: var(--color-primary, #ffd700);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-save-btn:hover:not(:disabled) {
    background: rgba(255, 215, 0, 0.3);
    border-color: rgba(255, 215, 0, 0.6);
}

.settings-save-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Subscription Info Section */
.settings-subscription-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin: 15px 0;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.subscription-info-left,
.subscription-info-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.subscription-label {
    font-size: 13px;
    color: #aaa;
    font-weight: 500;
}

.subscription-value {
    font-size: 15px;
    color: #fff;
    font-weight: 600;
}

.subscription-max {
    font-size: 12px;
    color: #777;
}

/* Settings Section Header with Button */
.settings-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
}

.settings-section-header .settings-section-title {
    margin-bottom: 0;
}

.settings-gift-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 107, 107, 0.3));
    color: #ffd700;
    border: 2px solid rgba(255, 215, 0, 0.5);
    border-radius: 15px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 6.1%;
    margin-bottom: 15px;
}

.settings-gift-btn:hover {
    border: 3px solid #3bb900;
    box-shadow: 0 0 12px #51ff00;
    transform: scale(1.1);
}

.settings-gift-btn:active {
    transform: translateY(0);
}

/* Gifted By Section */
.settings-gifted-by-section {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    margin: 10px 0 15px 0;
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.15), rgba(192, 108, 132, 0.15));
    border: 1px solid rgba(255, 107, 157, 0.3);
    border-radius: 8px;
}

.gifted-icon {
    font-size: 18px;
}

.gifted-label {
    font-size: 13px;
    color: #aaa;
    font-weight: 500;
}

.gifted-name {
    font-size: 14px;
    color: #ff6b9d;
    font-weight: 600;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 600px) {
    .settings-header-container {
        right: 10px;
        gap: 8px;
    }

    .user-mini-name {
        display: none;
    }

    .settings-modal {
        width: 95%;
        max-height: 90vh;
    }

    .settings-modal-header,
    .settings-modal-body,
    .settings-modal-footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .settings-profile-card {
        flex-direction: column;
        text-align: center;
    }

    .settings-modal-footer {
        flex-direction: column;
        gap: 12px;
    }

    .settings-footer-left,
    .settings-footer-right {
        width: 100%;
        justify-content: center;
    }
}