/* Fwog Studios Identity Hub */

/* ===== Design Tokens (Light) ===== */

:root {
    --bg: #f5f5f3;
    --bg-elevated: #ffffff;
    --bg-inset: #eaeae8;
    --text: #1a1b1e;
    --text-secondary: #2a2b30;
    --text-tertiary: #2f2f33;
    --border: #d4d5d9;
    --border-subtle: #e3e4e8;
    --accent: #1a7a3f;
    --accent-hover: #146831;
    --accent-text: #ffffff;
    --accent-subtle-bg: #e8f5ee;
    --accent-subtle-text: #146831;
    --danger: #c53030;
    --danger-hover: #a52828;
    --danger-text: #ffffff;
    --link: #1a7a3f;
    --link-hover: #146831;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --focus-ring: 0 0 0 3px rgba(26,122,63,0.25);
    --provider-btn-border: rgba(0,0,0,0.08);
    --discord: #5865F2;
    --twitch: #9146FF;
    --kick: #53FC18;
    --steam: #1b2838;
    --patreon: #d43d47;
    --alert-warning-bg: #fef8e7;
    --alert-warning-border: #e8b931;
    --alert-warning-text: #6b5000;
    --alert-error-bg: #fde8e8;
    --alert-error-border: #e07070;
    --alert-error-text: #8b1a1a;
    --alert-info-bg: #e7f0f7;
    --alert-info-border: #7aadcf;
    --alert-info-text: #0a4060;
    --alert-success-bg: #e8f5ee;
    --alert-success-border: #5aad75;
    --alert-success-text: #146831;
    --radius: 8px;
    --radius-sm: 6px;
}

/* ===== Dark Tokens (system) ===== */

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #141416;
        --bg-elevated: #1e1f23;
        --bg-inset: #111113;
        --text: #e4e4e8;
        --text-secondary: #d6d6dc;
        --text-tertiary: #cccccc;
        --border: #2e2f34;
        --border-subtle: #252629;
        --accent: #3dab68;
        --accent-hover: #4ebd7a;
        --accent-text: #062e14;
        --accent-subtle-bg: #152a1e;
        --accent-subtle-text: #3dab68;
        --danger: #d63e3e;
        --danger-hover: #e05454;
        --danger-text: #ffffff;
        --link: #3dab68;
        --link-hover: #4ebd7a;
        --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
        --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
        --focus-ring: 0 0 0 3px rgba(61,171,104,0.25);
        --provider-btn-border: rgba(255,255,255,0.12);
        --steam: #3a6080;
        --alert-warning-bg: #2a2308;
        --alert-warning-border: #5c4c0a;
        --alert-warning-text: #f7e2a0;
        --alert-error-bg: #2e1212;
        --alert-error-border: #5c1f1f;
        --alert-error-text: #f8cccc;
        --alert-info-bg: #0c1e28;
        --alert-info-border: #16405a;
        --alert-info-text: #cde4f3;
        --alert-success-bg: #122a1c;
        --alert-success-border: #1e4a2e;
        --alert-success-text: #c6eed4;
    }
}

/* ===== Dark Tokens (forced) ===== */

:root[data-theme="dark"] {
    --bg: #141416;
    --bg-elevated: #1e1f23;
    --bg-inset: #111113;
    --text: #e4e4e8;
    --text-secondary: #d6d6dc;
    --text-tertiary: #cccccc;
    --border: #2e2f34;
    --border-subtle: #252629;
    --accent: #3dab68;
    --accent-hover: #4ebd7a;
    --accent-text: #062e14;
    --accent-subtle-bg: #152a1e;
    --accent-subtle-text: #3dab68;
    --danger: #d63e3e;
    --danger-hover: #e05454;
    --danger-text: #ffffff;
    --link: #3dab68;
    --link-hover: #4ebd7a;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
    --focus-ring: 0 0 0 3px rgba(61,171,104,0.25);
    --provider-btn-border: rgba(255,255,255,0.12);
    --steam: #3a6080;
    --alert-warning-bg: #2a2308;
    --alert-warning-border: #5c4c0a;
    --alert-warning-text: #f7e2a0;
    --alert-error-bg: #2e1212;
    --alert-error-border: #5c1f1f;
    --alert-error-text: #f8cccc;
    --alert-info-bg: #0c1e28;
    --alert-info-border: #16405a;
    --alert-info-text: #cde4f3;
    --alert-success-bg: #122a1c;
    --alert-success-border: #1e4a2e;
    --alert-success-text: #c6eed4;
}

/* ===== Reset ===== */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ===== Base ===== */

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 1rem;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 {
    line-height: 1.3;
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

a {
    color: var(--link);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* ===== Layout ===== */

.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 2rem 1.25rem;
}

/* ===== Site Header ===== */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.header h1 {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.header-sub {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 0.0625rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 500;
}

.theme-select {
    padding: 0.25rem 0.375rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
}

.theme-select:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* ===== Alerts ===== */

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid;
    border-left-width: 3px;
    margin-bottom: 1rem;
    font-size: 0.9375rem;
}

.alert-warning {
    background: var(--alert-warning-bg);
    border-color: var(--alert-warning-border);
    color: var(--alert-warning-text);
}

.alert-error {
    background: var(--alert-error-bg);
    border-color: var(--alert-error-border);
    color: var(--alert-error-text);
}

.alert-info {
    background: var(--alert-info-bg);
    border-color: var(--alert-info-border);
    color: var(--alert-info-text);
}

.alert-success {
    background: var(--alert-success-bg);
    border-color: var(--alert-success-border);
    color: var(--alert-success-text);
}

.link-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ===== Buttons ===== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    line-height: 1.5;
    font-family: inherit;
    background: var(--bg-elevated);
    color: var(--text);
}

.btn:hover {
    text-decoration: none;
    background: var(--bg-inset);
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.btn-primary {
    background: var(--accent);
    color: var(--accent-text);
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-danger {
    background: var(--danger);
    color: var(--danger-text);
    border-color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger-hover);
    border-color: var(--danger-hover);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--bg-inset);
}

.btn-small {
    padding: 0.25rem 0.625rem;
    font-size: 0.8125rem;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn + .btn {
    margin-left: 0.5rem;
}

/* ===== Provider Buttons ===== */

.provider-btn {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--provider-btn-border);
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-weight: 600;
    color: #ffffff;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: transform 0.1s ease, box-shadow 0.15s ease;
    font-family: inherit;
}

.provider-btn:hover {
    text-decoration: none;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.provider-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.provider-btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.provider-discord { background-color: var(--discord); }
.provider-twitch { background-color: var(--twitch); }
.provider-kick { background-color: var(--kick); color: #000000; }
.provider-kick:hover { color: #000000; }
.provider-steam { background-color: var(--steam); }
.provider-patreon { background-color: var(--patreon); }

/* ===== Provider Badges ===== */

.provider-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    color: #ffffff;
    line-height: 1.5;
}

.provider-badge.provider-discord { background: var(--discord); }
.provider-badge.provider-twitch { background: var(--twitch); }
.provider-badge.provider-kick { background: var(--kick); color: #000; }
.provider-badge.provider-steam { background: var(--steam); }
.provider-badge.provider-patreon { background: var(--patreon); }

/* ===== Forms ===== */

form {
    margin: 0;
}

.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--text);
}

input[type="text"],
input[type="email"] {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    background: var(--bg-elevated);
    color: var(--text);
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="text"]:focus,
input[type="email"]:focus {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
    outline: none;
}

input[type="text"]::placeholder {
    color: var(--text-tertiary);
}

input[type="radio"],
input[type="checkbox"] {
    accent-color: var(--accent);
}

input[type="radio"] {
    margin-right: 0.5rem;
}

input[type="checkbox"] {
    margin-right: 0.5rem;
}

.checkbox-option,
.radio-option {
    display: flex;
    align-items: baseline;
    padding: 0.375rem 0;
    font-size: 0.9375rem;
    cursor: pointer;
    gap: 0.125rem;
}

fieldset {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin: 0;
}

legend {
    font-weight: 600;
    font-size: 0.9375rem;
    padding: 0 0.375rem;
}

/* ===== Cards ===== */

.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

.card-header {
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.card-danger {
    border-left: 3px solid var(--danger);
}

/* ===== Lists ===== */

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-subtle);
}

.list-item:last-child {
    border-bottom: none;
}

.list-item-info {
    flex: 1;
}

.list-item-info .provider-name {
    font-weight: 500;
}

.list-item-info .provider-username {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ===== Linked Accounts ===== */

.linked-list {
    list-style: none;
    padding: 0;
}

.linked-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--border-subtle);
}

.linked-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.linked-info {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.linked-username {
    font-size: 0.9375rem;
}

/* ===== Merge Comparison ===== */

.merge-comparison {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.merge-account {
    flex: 1;
}

.merge-account h3 {
    margin-bottom: 0.75rem;
}

.merge-name {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.merge-account ul {
    list-style: none;
    padding: 0;
}

.merge-account li {
    font-size: 0.9375rem;
    padding: 0.25rem 0;
}

/* ===== Actions ===== */

.actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.actions-center {
    justify-content: center;
}

/* ===== Navigation Links ===== */

.nav-links {
    list-style: none;
    padding: 0;
}

.nav-links li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-subtle);
}

.nav-links li:last-child {
    border-bottom: none;
}

/* ===== Account Header ===== */

.account-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}

.account-header-row h2 {
    margin-bottom: 0.125rem;
}

/* ===== Store ===== */

.product-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.product-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.product-card h3 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.375rem;
}

.product-card .product-desc {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.price-options {
    display: flex;
    gap: 0.75rem;
}

.price-option {
    flex: 1;
}

.price-option .btn {
    width: 100%;
    padding: 0.625rem 1rem;
    font-size: 0.9375rem;
}

.price-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.125rem;
    opacity: 0.85;
}

.price-amount {
    font-size: 1.125rem;
    font-weight: 700;
}

.price-interval {
    font-size: 0.8125rem;
    font-weight: 400;
    opacity: 0.8;
}

.product-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
}

/* ===== Purchase Details ===== */

.purchase-details {
    margin-top: 0.5rem;
}

.purchase-expiry {
    margin-top: 0.375rem;
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.product-card-inactive {
    opacity: 0.7;
}

.status-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    background: var(--accent-subtle-bg);
    color: var(--accent-subtle-text);
}

.status-active {
    background: var(--alert-success-bg);
    color: var(--alert-success-text);
}

.status-expired {
    background: var(--alert-warning-bg);
    color: var(--alert-warning-text);
}

.status-refunded, .status-disputed {
    background: var(--alert-error-bg);
    color: var(--alert-error-text);
}

/* ===== Minecraft Account ===== */

.mc-account-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mc-name-form {
    margin: 0;
}

.mc-name-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.mc-name-row input[type="text"] {
    flex: 1;
    padding: 0.375rem 0.625rem;
    font-size: 0.875rem;
}

/* ===== Store Success / Cancel ===== */

.result-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.result-card h2 {
    margin-bottom: 0.5rem;
}

.result-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.result-card p:last-child {
    margin-bottom: 0;
}

.result-card .btn {
    margin-bottom: 0.75rem;
}

.result-links {
    font-size: 0.875rem;
}

@media (max-width: 480px) {
    .price-options {
        flex-direction: column;
    }
}

/* ===== Focus ===== */

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn:focus-visible,
input:focus-visible,
select:focus-visible,
.provider-btn:focus-visible {
    outline: none;
}

/* ===== Reduced Motion ===== */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* ===== Responsive ===== */

@media (max-width: 560px) {
    .merge-comparison {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1.5rem 1rem;
    }

    .header {
        margin-bottom: 1.5rem;
    }
}

/* ===== Utilities ===== */

.subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.text-muted {
    color: var(--text-secondary);
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.ml-1 { margin-left: 0.5rem; }

.inline-form { display: inline; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
