/**
 * Settings Page Styles
 * Styles for the user settings/profile page
 */

/* Prevent horizontal scroll on settings page */
html:has(body.settings-page),
body.settings-page {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100vh;
    width: 100vw;
    max-width: 100vw;
}

/* Settings page wrapper - full width, centered content */
.settings-page-wrapper {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: var(--spacing-6xl) var(--spacing-xl);
    background: var(--color-bg-primary);
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
}

.settings-content {
    width: 100%;
    max-width: 800px;
    overflow-x: hidden;
    box-sizing: border-box;
}

.settings-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-5xl);
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* Back button - matching subscribe.html style */
.settings-back-button {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-2xl);
    gap: var(--spacing-sm);
    width: 109px;
    height: 48px;
    background: var(--color-bg-button-secondary);
    background: color(display-p3 1.000 1.000 1.000 / 0.08);
    border-radius: var(--radius-full);
    border: none;
    text-decoration: none;
    flex: none;
    order: 0;
    flex-grow: 0;
    cursor: pointer;
    transition: all var(--transition-base);
    align-self: flex-start;
}

.settings-back-button:hover {
    background: var(--color-button-secondary-hover);
    background: color(display-p3 1.000 1.000 1.000 / 0.12);
}

.settings-back-button:hover .settings-back-icon svg path,
.settings-back-button:hover .settings-back-icon-svg path {
    fill: #FFFFFF;
}

.settings-back-button:hover .settings-back-text {
    color: #FFFFFF;
    color: color(display-p3 1.000 1.000 1.000);
}

/* Light theme styles for back button */
body.light-theme .settings-back-button {
    background: rgba(0, 0, 0, 0.05);
    border: none;
}

body.light-theme .settings-back-button:hover {
    background: rgba(0, 0, 0, 0.1);
    border: none;
}

body.light-theme .settings-back-button .settings-back-icon svg path,
body.light-theme .settings-back-button .settings-back-icon-svg path {
    fill: #000000;
}

body.light-theme .settings-back-button .settings-back-text {
    color: #000000;
}

body.light-theme .settings-back-button:hover .settings-back-icon svg path,
body.light-theme .settings-back-button:hover .settings-back-icon-svg path {
    fill: #000000;
}

body.light-theme .settings-back-button:hover .settings-back-text {
    color: #000000;
}

.settings-back-icon {
    width: var(--spacing-lg);
    height: var(--spacing-lg);
    flex: none;
    order: 0;
    flex-grow: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-back-icon svg,
.settings-back-icon-svg {
    display: block;
    width: var(--spacing-lg);
    height: var(--spacing-lg);
    transition: fill var(--transition-base);
}

.settings-back-icon svg path,
.settings-back-icon-svg path {
    fill: var(--color-text-tertiary);
    transition: fill var(--transition-base);
}

.settings-back-text {
    width: 34px;
    height: 17px;
    font-family: var(--font-primary);
    font-style: normal;
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-md);
    line-height: 17px;
    text-align: center;
    color: var(--color-text-tertiary);
    color: color(display-p3 0.502 0.502 0.502);
    flex: none;
    order: 1;
    flex-grow: 0;
    transition: color var(--transition-base);
}

/* Main title */
.settings-main-title {
    font-family: var(--font-serif);
    font-size: var(--font-size-4xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    margin: 0;
    padding: 0;
}

.settings-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-4xl);
    max-width: 800px;
    width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.settings-block {
    background: #272727;
    border-radius: var(--radius-2xl);
    padding: var(--spacing-5xl);
    display: flex;
    flex-direction: column;
}

/* Light theme background */
body.light-theme .settings-block {
    background: rgb(255, 255, 255);
}

.settings-block-title {
    font-family: var(--font-primary);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    margin: 0;
}

.settings-block-description {
    font-family: var(--font-primary);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-normal);
    color: var(--color-text-secondary);
    margin: 16px 0 24px 0;
    line-height: var(--line-height-relaxed);
}

/* Ensure consistent spacing between title and description */
.settings-block-title + .settings-block-description {
    margin-top: 8px;
    margin-bottom: 24px;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2xl);
}

.settings-button {
    font-family: var(--font-primary);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    padding: var(--spacing-md) var(--spacing-2xl);
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    align-self: flex-start;
}

.settings-button-primary {
    background: var(--color-accent-primary);
    color: #FFFFFF !important;
}

.settings-button-primary:hover:not(:disabled) {
    background: var(--color-accent-hover);
    color: #FFFFFF !important;
    transform: translateY(-1px);
}

.settings-button-primary:active:not(:disabled) {
    background: var(--color-accent-active);
    color: #FFFFFF !important;
    transform: translateY(0);
}

.settings-button-primary:disabled {
    color: #FFFFFF !important;
}

.settings-button-secondary {
    background: var(--color-bg-button-secondary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border-secondary);
    border-radius: var(--radius-full);
}

.settings-button-secondary:hover:not(:disabled) {
    background: #ffffff;
    color: var(--color-text-inverse);
    transform: translateY(-1px);
}

/* Light theme styles for secondary button */
body.light-theme .settings-button-secondary {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.15);
    color: #000000;
}

body.light-theme .settings-button-secondary:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.2);
    color: #000000;
}

.settings-button-secondary:active:not(:disabled) {
    transform: translateY(0);
}

.settings-button-danger {
    background: transparent;
    color: var(--color-error);
    border: 1px solid var(--color-border-error);
}

.settings-button-danger:hover:not(:disabled) {
    background: var(--color-error);
    color: var(--color-text-inverse);
    border-color: var(--color-error);
}

.settings-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.settings-accounts-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.settings-account-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) 0;
    gap: var(--spacing-md);
}

.settings-account-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex: 1;
}

.settings-account-status-section {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 16px;
}

.settings-account-divider {
    height: 1px;
    background: var(--color-border-secondary);
    margin: var(--spacing-sm) 0;
}

.settings-account-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--color-bg-button-secondary);
    border: 1px solid var(--color-border-secondary);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: var(--font-primary);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
    width: 100%;
}

.settings-account-button:hover:not(:disabled) {
    background: #ffffff;
    color: var(--color-text-inverse);
    transform: translateY(-1px);
}

.settings-account-button:active:not(:disabled) {
    transform: translateY(0);
}

/* Light theme account buttons */
body.light-theme .settings-account-button {
    background: var(--color-bg-button-secondary-light);
    border-color: var(--color-border-primary);
    color: var(--color-text-primary);
}

body.light-theme .settings-account-button:hover:not(:disabled) {
    background: #ffffff;
    color: var(--color-text-inverse);
}

.settings-account-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.settings-account-button-connected {
    background: var(--color-bg-button-secondary);
    border-color: var(--color-border-secondary);
    color: var(--color-text-primary);
}

.settings-account-button-connected:hover:not(:disabled) {
    background: #ffffff;
    color: var(--color-text-inverse);
}

.settings-account-status {
    display: inline;
    font-size: 16px;
    color: var(--color-accent-primary);
    font-weight: var(--font-weight-medium);
}

.settings-account-separator {
    display: inline;
    color: var(--color-border-secondary);
    margin: 0 var(--spacing-xs);
}

.settings-account-disconnect-link {
    display: inline;
    font-size: 16px;
    color: var(--color-error);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-base);
    font-weight: var(--font-weight-medium);
}

.settings-account-disconnect-link:hover {
    color: var(--color-error);
    opacity: 0.8;
    text-decoration: underline;
}

.settings-account-connect-link {
    display: inline;
    font-size: 16px;
    color: var(--color-accent-primary);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-base);
    font-weight: var(--font-weight-medium);
}

.settings-account-connect-link:hover {
    color: var(--color-accent-primary);
    opacity: 0.8;
    text-decoration: underline;
}

.settings-account-disconnect-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all var(--transition-base);
    margin-left: var(--spacing-xs);
}

.settings-account-disconnect-icon-btn:hover {
    opacity: 0.7;
}

.settings-account-disconnect-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

.settings-account-disconnect-icon-svg {
    width: 16px;
    height: 16px;
    color: var(--color-error);
}

.settings-account-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--spacing-sm);
    padding-left: calc(24px + var(--spacing-md));
}

.settings-account-disconnect-btn,
.settings-account-connect-btn {
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-tertiary);
    background: transparent;
    color: var(--color-text-inverse);
    font-family: var(--font-primary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all var(--transition-base);
}

.settings-account-disconnect-btn:hover {
    background: rgba(255, 68, 68, 0.1);
    border-color: var(--color-error);
    color: var(--color-error);
}

.settings-account-connect-btn:hover {
    background: rgba(14, 124, 102, 0.1);
    border-color: var(--color-accent-primary);
    color: var(--color-accent-primary);
}

.settings-account-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.settings-account-icon-svg {
    width: 24px;
    height: 24px;
}

.settings-account-text {
    flex: 1;
    text-align: left;
}

/* Theme selector - three rectangular blocks */
.settings-theme-selector {
    display: flex;
    gap: var(--spacing-lg);
    width: 100%;
}

.settings-theme-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-xl);
    background: var(--color-bg-secondary);
    border: 2px solid var(--color-border-tertiary);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: var(--font-primary);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
    min-height: 160px;
}

/* Light theme option */
#themeLight {
    background: #272727;
}

#themeLight .settings-theme-label {
    color: #ffffff;
}

.settings-theme-option:hover {
    border-color: var(--color-border-secondary);
    background: var(--color-bg-button-secondary-hover);
    transform: translateY(-2px);
}

.settings-theme-option.active {
    border-color: var(--color-accent-primary);
    background: rgba(14, 124, 102, 0.1) !important;
}

.settings-theme-option.active .settings-theme-label {
    color: #ffffff !important;
}

.settings-theme-option.active:hover {
    border-color: var(--color-accent-primary);
    background: rgba(14, 124, 102, 0.1) !important;
}

.settings-theme-option.active:hover .settings-theme-label {
    color: #ffffff !important;
}

/* Light theme button - text should be black when active */
#themeLight.active .settings-theme-label,
#themeLight.active:hover .settings-theme-label,
body.light-theme #themeLight.active .settings-theme-label,
body.light-theme #themeLight.active:hover .settings-theme-label {
    color: #000000 !important;
}

/* Theme illustration container */
.settings-theme-illustration {
    width: 100%;
    height: 100px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Dark theme illustration */
.settings-theme-illustration-dark {
    width: 100%;
    height: 100%;
    background: #1A1A1A;
    position: relative;
    border-radius: var(--radius-lg);
}

.settings-theme-illustration-dark::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40%;
    height: 20%;
    background: #272727;
    border-radius: var(--radius-md);
}

.settings-theme-illustration-dark::after {
    display: none;
}

/* Light theme illustration */
.settings-theme-illustration-light {
    width: 100%;
    height: 100%;
    background: #ffffff;
    position: relative;
    border-radius: var(--radius-lg);
}

.settings-theme-illustration-light::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40%;
    height: 20%;
    background: #f5f5f5;
    border-radius: var(--radius-md);
    border: 1px solid #e0e0e0;
}

.settings-theme-illustration-light::after {
    display: none;
}

/* System theme illustration - divided into two parts */
.settings-theme-illustration-system {
    width: 100%;
    height: 100%;
    background: #121212;
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.settings-theme-illustration-system::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: #121212;
}

.settings-theme-illustration-system::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    background: #ffffff;
}

/* System theme option */
#themeSystem {
    background: #272727;
}

#themeSystem .settings-theme-label {
    color: #ffffff;
}

/* When system theme is active, Dark block should have #272727 background */
.settings-theme-selector:has(#themeSystem.active) #themeDark {
    background: #272727 !important;
}

.settings-theme-selector:has(#themeSystem.active) #themeDark:hover {
    background: #272727 !important;
}

/* System theme button - text should be black when active */
#themeSystem.active .settings-theme-label,
#themeSystem.active:hover .settings-theme-label,
body.light-theme #themeSystem.active .settings-theme-label,
body.light-theme #themeSystem.active:hover .settings-theme-label {
    color: #ffffff !important;
}

.settings-theme-label {
    font-weight: var(--font-weight-medium);
    user-select: none;
}

.settings-message {
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-lg);
    font-family: var(--font-primary);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-relaxed);
}

.settings-message-success {
    background: rgba(14, 124, 102, 0.2);
    color: var(--color-accent-primary);
    border: 1px solid var(--color-accent-primary);
}

.settings-message-error {
    background: rgba(255, 68, 68, 0.2);
    color: var(--color-error);
    border: 1px solid var(--color-border-error);
}

.settings-block-danger {
    border: none;
}

/* Form inputs in settings */
.settings-form .form-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.settings-form .form-label {
    font-family: var(--font-primary);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
}

.settings-form .form-input {
    font-family: var(--font-primary);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-normal);
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-tertiary);
    border-radius: var(--radius-xl);
    color: var(--color-text-primary);
    caret-color: var(--color-accent-primary);
    transition: all var(--transition-base);
}

.settings-form .form-input:focus {
    outline: none;
    border-color: var(--color-accent-primary);
    background: var(--color-bg-secondary);
}

.settings-form .form-input:read-only {
    background: var(--color-bg-secondary);
    opacity: 0.6;
    cursor: not-allowed;
}

/* Responsive styles */
@media (max-width: 768px) {
    .settings-page-wrapper {
        padding: var(--spacing-4xl) var(--spacing-lg);
    }

    .settings-content-wrapper {
        gap: var(--spacing-4xl);
    }

    .settings-main-title {
        font-size: var(--font-size-3xl);
    }

    .settings-container {
        gap: var(--spacing-3xl);
    }

    .settings-block {
        padding: var(--spacing-4xl);
    }

    .settings-block-title {
        font-size: var(--font-size-lg);
    }

    .settings-block-description {
        font-size: var(--font-size-sm);
    }

    .settings-button {
        width: 100%;
        align-self: stretch;
    }

    .settings-accounts {
        flex-direction: column;
    }

    .settings-account-item {
        width: 100%;
        min-width: 100%;
    }

    .settings-account-button {
        width: 100%;
    }

    .settings-theme-selector {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .settings-theme-option {
        width: 100%;
        min-height: 140px;
    }

    .settings-theme-illustration {
        height: 80px;
    }
}

