/* Settings Window Overlay */
.settings-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.settings-overlay.open {
    display: flex !important;
    opacity: 1;
}

.settings-overlay.closing {
    opacity: 0;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
}

/* Settings Window */
.settings-window {
    width: 900px;
    height: 640px;
    min-width: 700px;
    min-height: 500px;
    background: rgba(30, 30, 30, 0.95);
    border-radius: 12px;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.5),
        0 0 0 0.5px rgba(255, 255, 255, 0.1);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    animation: slideUp 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: transform, opacity;
    position: relative;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* Title Bar */
.settings-window .title-bar {
    height: 40px;
    background: rgba(40, 40, 45, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    padding: 0 16px;
    flex-shrink: 0;
}

.settings-window .window-title {
    flex: 1;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    user-select: none;
}

/* Traffic Lights */
.settings-window .traffic-lights {
    display: flex;
    gap: 8px;
    z-index: 10;
}

.settings-window .traffic-light {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.settings-window .traffic-light.close {
    background: #ff5f57;
}

.settings-window .traffic-light.minimize {
    background: #febc2e;
}

.settings-window .traffic-light.maximize {
    background: #28c840;
}

.settings-window .traffic-light:hover {
    filter: brightness(1.2);
}

.settings-window .traffic-light:active {
    filter: brightness(0.9);
}

.settings-window.active {
    box-shadow: 
        0 30px 60px rgba(0, 0, 0, 0.6),
        0 0 0 0.5px rgba(255, 255, 255, 0.15);
}

.settings-window.inactive {
    box-shadow: 
        0 15px 30px rgba(0, 0, 0, 0.4),
        0 0 0 0.5px rgba(255, 255, 255, 0.08);
}

.settings-window.minimized {
    animation: slideDown 0.4s cubic-bezier(0.8, 0.2, 0.8, 0.2) forwards;
}

/* Settings Content Layout */
.settings-content {
    display: flex;
    height: calc(100% - 40px);
    overflow: hidden;
}

/* Sidebar */
.settings-sidebar {
    width: 280px;
    background: rgba(20, 20, 20, 0.8);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    padding: 16px 12px;
    overflow-y: auto;
    flex-shrink: 0;
}

.settings-sidebar::-webkit-scrollbar {
    width: 6px;
}

.settings-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.settings-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* Search Bar */
.settings-search {
    position: relative;
    margin-bottom: 16px;
}

.settings-search input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    transition: all 0.2s ease;
}

.settings-search input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

.settings-search svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
}

/* Account Card */
.settings-account-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    margin-bottom: 20px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.settings-account-card:hover {
    background: rgba(255, 255, 255, 0.09);
}

.settings-account-card img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.account-name {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 2px;
}

.account-subtitle {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

/* Categories */
.settings-categories {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-category {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
}

.settings-category:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.08);
}

.settings-category.active {
    background: rgba(59, 130, 246, 0.3);
    color: #fff;
}

.settings-category.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.settings-category svg {
    flex-shrink: 0;
    opacity: 0.8;
}

/* Main Content Area */
.settings-main {
    flex: 1;
    padding: 32px 40px;
    overflow-y: auto;
    background: rgba(25, 25, 25, 0.6);
}

.settings-main::-webkit-scrollbar {
    width: 8px;
}

.settings-main::-webkit-scrollbar-track {
    background: transparent;
}

.settings-main::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

/* Panel */
.settings-panel {
    display: none;
}

.settings-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.settings-panel-header {
    margin-bottom: 32px;
}

.settings-panel-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 8px 0;
}

.settings-panel-header p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
}

/* Theme Toggle Section */
.theme-toggle-section {
    margin-bottom: 32px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.theme-toggle span {
    font-size: 15px;
    font-weight: 500;
    color: #fff;
}

.theme-toggle select {
    padding: 6px 32px 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M1 1L5 5L9 1' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 10px 6px;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.theme-toggle select:hover {
    background: rgba(255, 255, 255, 0.15);
}

.theme-toggle select:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.theme-toggle select option {
    background: #1a1a1a;
    color: #fff;
}

.theme-hint {
    margin-top: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.4;
}

/* Wallpaper Grid */
.wallpaper-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.wallpaper-item {
    position: relative;
    aspect-ratio: 16 / 10;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.05);
}

.wallpaper-item:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.wallpaper-item.selected {
    border-color: rgb(59, 130, 246);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.wallpaper-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.wallpaper-item:hover img {
    transform: scale(1.05);
}

.wallpaper-item .checkmark {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: rgb(59, 130, 246);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s ease;
}

.wallpaper-item.selected .checkmark {
    opacity: 1;
    transform: scale(1);
}

.wallpaper-item .checkmark svg {
    width: 14px;
    height: 14px;
    color: white;
}

.wallpaper-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    font-size: 12px;
    color: #fff;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.wallpaper-item:hover .wallpaper-name {
    opacity: 1;
}

/* Default Preview Styles */
.default-preview {
    width: 100%;
    height: 100%;
    position: relative;
    background: 
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(120, 119, 198, 0.15), transparent 50%),
        radial-gradient(ellipse 60% 50% at 50% 120%, rgba(180, 120, 200, 0.1), transparent 50%),
        linear-gradient(180deg, #0a0a0f, #0f0f14 40%, #141419 100%);
    overflow: hidden;
}

.preview-aurora {
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background: radial-gradient(
        ellipse at center,
        rgba(139, 92, 246, 0.3) 0%,
        rgba(59, 130, 246, 0.2) 40%,
        transparent 70%
    );
    animation: previewRotate 20s linear infinite;
}

.preview-particles {
    position: absolute;
    inset: 0;
    background-image: 
        radial-gradient(2px 2px at 20% 30%, white, transparent),
        radial-gradient(2px 2px at 60% 70%, white, transparent),
        radial-gradient(1px 1px at 50% 50%, white, transparent),
        radial-gradient(1px 1px at 80% 10%, white, transparent),
        radial-gradient(2px 2px at 90% 60%, white, transparent);
    background-size: 200% 200%;
    background-position: 0% 0%, 100% 100%, 50% 50%, 0% 100%, 100% 0%;
    opacity: 0.4;
    animation: previewFloat 15s ease-in-out infinite;
}

@keyframes previewRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes previewFloat {
    0%, 100% { background-position: 0% 0%, 100% 100%, 50% 50%, 0% 100%, 100% 0%; }
    50% { background-position: 100% 100%, 0% 0%, 60% 40%, 100% 0%, 0% 100%; }
}

/* Light Theme Styles */
body.light-theme .settings-window {
    background: rgba(240, 240, 245, 0.98);
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.15),
        0 0 0 0.5px rgba(0, 0, 0, 0.1);
}

body.light-theme .settings-window.active {
    box-shadow: 
        0 30px 60px rgba(0, 0, 0, 0.2),
        0 0 0 0.5px rgba(0, 0, 0, 0.15);
}

body.light-theme .settings-sidebar {
    background: rgba(230, 230, 235, 0.9);
    border-right: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-theme .settings-search input {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: rgba(0, 0, 0, 0.7);
}

body.light-theme .settings-search svg {
    color: rgba(0, 0, 0, 0.4);
}

body.light-theme .settings-account-card {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-theme .account-name {
    color: #000;
}

body.light-theme .account-subtitle {
    color: rgba(0, 0, 0, 0.5);
}

body.light-theme .settings-category {
    color: rgba(0, 0, 0, 0.85);
}

body.light-theme .settings-category:hover:not(.disabled) {
    background: rgba(0, 0, 0, 0.08);
}

body.light-theme .settings-main {
    background: rgba(255, 255, 255, 0.6);
}

body.light-theme .settings-panel-header h2 {
    color: #000;
}

body.light-theme .settings-panel-header p {
    color: rgba(0, 0, 0, 0.6);
}

body.light-theme .theme-toggle-section {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-theme .theme-toggle span {
    color: #000;
}

body.light-theme .theme-toggle select {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.15);
    color: #000;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

body.light-theme .theme-toggle select option {
    background: #f0f0f5;
    color: #000;
}

body.light-theme .wallpaper-item {
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme .wallpaper-name {
    background: linear-gradient(to top, rgba(255, 255, 255, 0.95), transparent);
    color: #000;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
