/* =========================================================
   BiiP.app - Shared Brand UI/UX
   Single source of truth for auth + auth-adjacent pages.
   Reference: client/dashboard.html / client/index.html
   Served at:  /public/brand.css
   ========================================================= */

:root {
    /* Brand Colors - Dark (Default Obsidian) */
    --bg-color: #050505;
    --card-bg: #111111;
    --text-main: #ffffff;
    --text-muted: #888888;
    --brand-orange: #ff5a00;
    --brand-orange-hover: #e04f00;

    /* UI Elements */
    --card-border: rgba(255, 255, 255, 0.05);
    --btn-ghost-border: rgba(255, 255, 255, 0.2);
    --btn-ghost-text: #ffffff;
}

[data-theme="light"] {
    /* Brand Colors - Light */
    --bg-color: #f9f9f9;
    --card-bg: #ffffff;
    --text-main: #050505;
    --text-muted: #666666;

    /* UI Elements */
    --card-border: rgba(0, 0, 0, 0.08);
    --btn-ghost-border: rgba(0, 0, 0, 0.2);
    --btn-ghost-text: #050505;
}

/* --- Base --- */
* {
    box-sizing: border-box;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Allow text selection in form elements */
input,
textarea,
select {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

a {
    color: var(--brand-orange);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* --- Top Bar / Branding --- */

.top-bar a {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}

.top-bar {
    width: 100%;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    max-width: 600px;
}

#app-logo {
    width: 34px;
    height: 34px;
    display: block;
}

#app-brand {
    height: 26px;
    width: auto;
    display: block;
}

/* --- Auth Card --- */
.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 32px;
    width: 100%;
    max-width: 420px;
    padding: 40px 30px;
    margin: 16px 0 90px 0;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.auth-card h1,
.auth-card h2 {
    text-align: center;
    margin: 0 0 10px 0;
    color: var(--text-main);
    font-weight: 600;
    font-size: 1.6rem;
    line-height: 1.2;
}

.auth-card .subtitle,
.auth-card > p {
    text-align: center;
    color: var(--text-muted);
    margin: 0 0 28px 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* --- Form --- */
.form-group {
    margin-bottom: 18px;
    text-align: left;
}

.form-group label,
.auth-card label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.auth-card input[type="text"],
.auth-card input[type="password"],
.auth-card input[type="email"],
.auth-card .form-input {
    width: 100%;
    background: transparent;
    border: 1px solid var(--btn-ghost-border);
    border-radius: 16px;
    padding: 12px 16px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-card input[type="text"]:focus,
.auth-card input[type="password"]:focus,
.auth-card input[type="email"]:focus,
.auth-card .form-input:focus {
    border-color: var(--brand-orange);
    box-shadow: 0 0 0 3px rgba(255, 90, 0, 0.15);
}

.auth-card input[type="text"]::placeholder,
.auth-card input[type="password"]::placeholder,
.auth-card input[type="email"]::placeholder,
.auth-card .form-input::placeholder {
    color: var(--text-muted);
}

/* Password field with eye toggle */
.password-container {
    position: relative;
    display: flex;
    align-items: center;
}

.password-container input {
    padding-right: 45px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: color 0.2s ease;
}

.password-toggle:hover,
.password-toggle:focus {
    color: var(--brand-orange);
    outline: none;
}

/* Checkbox (remember me) */
.remember-me,
.checkbox,
.auth-card .checkbox {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    margin: 18px 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.remember-me input[type="checkbox"],
.checkbox input[type="checkbox"],
.auth-card input[type="checkbox"] {
    margin-right: 10px;
    width: 16px;
    height: 16px;
    accent-color: var(--brand-orange);
}

.remember-me label,
.checkbox label {
    margin: 0;
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.9rem;
}

/* --- Buttons --- */
.btn-primary {
    display: block;
    width: 100%;
    background: var(--brand-orange);
    color: #ffffff;
    border: none;
    border-radius: 100px;
    padding: 14px 24px;
    font-size: 1.05rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    margin: 8px 0;
    transition: all 0.2s ease;
    box-shadow: 0 10px 25px rgba(255, 90, 0, 0.3);
}

.btn-primary:hover {
    background: var(--brand-orange-hover);
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(255, 90, 0, 0.4);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: transparent;
    color: var(--btn-ghost-text);
    border: 1px solid var(--btn-ghost-border);
    border-radius: 100px;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-ghost:hover {
    background: var(--text-main);
    color: var(--bg-color);
    border-color: var(--text-main);
    text-decoration: none;
}

/* --- Links within the card --- */
.auth-card .register-link,
.auth-card .login-link,
.auth-card .form-link {
    display: block;
    width: 100%;
    text-align: center;
    margin: 14px 0;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--brand-orange);
    text-decoration: none;
}

.auth-card .register-link:hover,
.auth-card .login-link:hover,
.auth-card .form-link:hover {
    text-decoration: underline;
}

/* Terms / legal text */
.terms-text {
    text-align: center;
    margin-top: 24px;
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 100%;
    word-wrap: break-word;
}

.terms-text a {
    color: var(--brand-orange);
}

/* --- Error / status messages --- */
.error-message {
    display: none;
    text-align: center;
    padding: 12px 16px;
    background: rgba(255, 90, 90, 0.1);
    border: 1px solid rgba(255, 90, 90, 0.4);
    border-radius: 16px;
    color: #ff6a6a;
    font-size: 0.85rem;
    margin: 14px 0;
    animation: brandFadeIn 0.3s ease-in;
}

.error-message.show,
.error-message.visible {
    display: block;
}

@keyframes brandFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.message {
    text-align: center;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.85rem;
    margin: 14px 0;
    display: none;
}

.success-message {
    display: none;
    background: rgba(61, 220, 132, 0.1);
    border: 1px solid rgba(61, 220, 132, 0.4);
    color: #3ddc84;
}

/* Password requirement hints */
.password-requirements {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 8px;
    line-height: 1.5;
    text-align: left;
}

.password-requirements ul {
    margin: 6px 0;
    padding-left: 18px;
}

.password-requirements li {
    margin-bottom: 3px;
}

.password-requirements .valid {
    color: #3ddc84;
}

.password-requirements .invalid {
    color: var(--text-muted);
}

/* --- Brand Modal / Overlay (for inline overlays) --- */
.brand-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
}

.brand-overlay.open,
.brand-overlay.active {
    display: flex;
}

.brand-modal {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 32px;
    width: 100%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.brand-modal h2 {
    margin-top: 0;
    font-weight: 600;
}

.brand-modal p {
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 24px;
}

/* --- Minimal Footer (theme + language) --- */
.minimal-footer {
    width: 100%;
    max-width: 600px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    position: fixed;
    bottom: 0;
    /*background: linear-gradient(to top, var(--bg-color) 60%, transparent);*/
    z-index: 100;
}

.theme-toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.theme-toggle-btn:hover {
    color: var(--text-main);
}

.theme-toggle-btn svg {
    width: 22px;
    height: 22px;
}

.language-dropdown {
    display: inline-flex;
    align-items: center;
}

.language-dropdown select {
    background: transparent;
    color: var(--text-muted);
    border: none;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    appearance: none;
    padding: 6px 24px 6px 12px;
    border: 1px solid var(--btn-ghost-border);
    border-radius: 100px;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
}

.language-dropdown select option {
    background: var(--card-bg);
    color: var(--text-main);
}

/* --- Responsive --- */
@media (max-width: 480px) {
    body {
        padding: 0 12px;
    }

    .auth-card {
        padding: 30px 22px;
        margin-bottom: 76px;
    }

    .auth-card h1,
    .auth-card h2 {
        font-size: 1.4rem;
    }

    .minimal-footer {
        padding: 14px 12px;
    }
}

@media (max-width: 360px) {
    .auth-card {
        padding: 24px 18px;
    }
}
