/* --------------------------------------------------------------
   Roundcube Elastic‑inspired theme for Postfix Admin
   -------------------------------------------------------------- */
:root {
    --bg-color: #f8f9fa;          /* page background */
    --card-bg: #ffffff;           /* card background */
    --primary: #2a7ae2;           /* button blue (Roundcube‑like) */
    --primary-hover: #256ed1;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --input-bg: #ffffff;
    --input-border: #ced4da;
    --input-focus: #86b7fe;
    --radius: .3rem;              /* slight rounding */
}
/* Smooth color transition on theme switch */
*,
*::before,
*::after {
    transition:
        background-color 400ms ease,
        border-color     400ms ease,
        color            300ms ease,
        box-shadow       400ms ease,
        filter           400ms ease;
}
input,
button,
.button,
.toggle-pass,
#theme-toggle {
    transition:
        background-color 400ms ease,
        border-color     400ms ease,
        color            300ms ease,
        box-shadow       150ms ease;
}
/* Page layout – center the card vertically & horizontally */
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI',
                 Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-color);
    color: #212529;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

/* Card container */
.form-container {
    max-width: 400px;
    width: 90%;
    margin: 80px auto;               /* top/bottom space */
    padding: 30px;
    background: var(--card-bg);
    border-radius: 5px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

/* Form groups – vertical spacing */
.form-group {
    margin-bottom: 15px;
}

/* Labels */
label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: .9rem;
}

/* Input wrapper – username + domain span */
.input-wrapper {
    display: flex;
    align-items: center;
}

.input-wrapper input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--input-border);
    border-radius: 3px 0 0 3px;      /* left rounded */
    font-size: 1rem;
    transition: border-color .15s, box-shadow .15s;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(42,122,226,.15);
}

/* Domain label on the right */
.input-wrapper .domain {
    padding: 10px;
    background: #eee;
    border: 1px solid var(--input-border);
    border-left: none;
    border-radius: 0 3px 3px 0;
    font-size: 1rem;
    color: #495057;
}

/* Submit button */
.button {
    background-color: var(--primary);
    color: #fff;
    border: none;
    padding: 12px;
    width: 100%;
    border-radius: 3px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}

.button:hover {
    background-color: var(--primary-hover);
}

.button:active {
    transform: translateY(1px);
}

/* Error messages & helper text */
.error-msg {
    display: block;
    margin-top: .25rem;
    font-size: .85rem;
    color: #e74c3c;                  /* Roundcube‑style red */
    min-height: 1.2em;               /* reserve space so layout doesn’t jump */
}

small {
    display: block;
    margin-top: .25rem;
    font-size: .85rem;
    color: var(--text-muted);
}

/* make the card a bit narrower on very wide screens */
@media (max-width: 480px) {
    .form-container { padding: 20px; margin: 60px auto; }
}


/* ====================================================
   Standalone inputs (Full Name, Recovery E-mail)
   – matches .input-wrapper input exactly
   ==================================================== */
.form-group > input[type="text"],
.form-group > input[type="email"] {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    font-size: 1rem;
    border: 1px solid var(--input-border);
    border-radius: 3px;
    background: var(--input-bg);
    color: inherit;
    transition: border-color .15s, box-shadow .15s;
}

.form-group > input[type="text"]:focus,
.form-group > input[type="email"]:focus {
    outline: none;
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(42,122,226,.15);
}

/* ====================================================
   Password field wrapper (input + eye toggle button)
   ==================================================== */
.pass-wrapper input[type="password"],
.pass-wrapper input[type="text"] {
    flex: 1;
    border-radius: 3px 0 0 3px;
    border-right: none;
}

.toggle-pass {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 .75rem;
    background: #eee;
    border: 1px solid var(--input-border);
    border-left: none;
    border-radius: 0 3px 3px 0;
    cursor: pointer;
    color: var(--text-muted);
    transition: background .15s, color .15s;
    align-self: stretch;
}
.toggle-pass:hover {
    background: #ddd;
    color: #212529;
}

.eye-icon {
    width: 18px;
    height: 18px;
    display: block;
    pointer-events: none;
}

.theme-icon {
    width: 18px;
    height: 18px;
    display: block;
    pointer-events: none;
}

html[data-theme="dark"] .theme-icon {
    filter: invert(1) brightness(0.8);   /* same treatment as eye icon in dark mode */
}

/* ====================================================
   Password strength bar
   ==================================================== */
.strength-bar-wrap {
    margin-top: .5rem;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.strength-bar {
    height: 100%;
    width: 0;
    border-radius: 2px;
    transition: width .3s ease, background-color .3s ease;
}

.strength-bar.str-weak   { width: 20%;  background: #e74c3c; }
.strength-bar.str-fair   { width: 50%;  background: #f39c12; }
.strength-bar.str-good   { width: 75%;  background: #2ecc71; }
.strength-bar.str-strong { width: 100%; background: #27ae60; }

.strength-label {
    display: block;
    margin-top: .25rem;
    font-size: .8rem;
    font-weight: 600;
    min-height: 1.2em;
}

/* ====================================================
   Password requirements checklist
   ==================================================== */
.pass-req {
    list-style: none;
    margin: .5rem 0 0;
    padding: 0;
}

.pass-req li {
    font-size: .8rem;
    color: var(--text-muted);
    padding: .15rem 0 .15rem 1.4rem;
    position: relative;
    transition: color .2s;
}

.pass-req li::before { content: "○"; position: absolute; left: 0; color: var(--text-muted); }
.pass-req li.ok      { color: #27ae60; }
.pass-req li.ok::before  { content: "✓"; color: #27ae60; }
.pass-req li.fail    { color: #e74c3c; }
.pass-req li.fail::before { content: "✗"; color: #e74c3c; }

/* ====================================================
   Success / result message
   ==================================================== */
.result-msg {
    background: #eafaf1;
    border: 1px solid #a9dfbf;
    color: #1e8449;
    border-radius: var(--radius);
    padding: .85rem 1rem;
    margin-bottom: 1.25rem;
    font-size: .9rem;
}

/* ====================================================
   Dark mode toggle button (top-right of card)
   ==================================================== */
.form-container {
    position: relative;
}

#theme-toggle {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 50%;
    transition: background .15s;
}
#theme-toggle:hover {
    background: rgba(0,0,0,.08);
}

/* ====================================================
   Dark mode – matte dark greyish-blue (Roundcube-style)
   ==================================================== */
html[data-theme="dark"] {
    --bg-color:      #2b3140;
    --card-bg:       #343d52;
    --primary:       #4a90d9;
    --primary-hover: #3a7fc1;
    --text-muted:    #8b96a8;
    --border-color:  #4a5568;
    --input-bg:      #3a4355;
    --input-border:  #4a5568;
    --input-focus:   #6a9fd8;
}

html[data-theme="dark"] body {
    color: #d0d6e0;
}

html[data-theme="dark"] .form-container {
    box-shadow: 0 3px 15px rgba(0,0,0,.4);
}

html[data-theme="dark"] .input-wrapper .domain {
    background: #404857;
    color: #a0aab8;
    border-color: var(--input-border);
}

html[data-theme="dark"] .toggle-pass {
    background: #404857;
    border-color: var(--input-border);
    color: #8b96a8;
}
html[data-theme="dark"] .toggle-pass:hover {
    background: #4a5568;
    color: #d0d6e0;
}

html[data-theme="dark"] .eye-icon {
    filter: invert(1) brightness(0.8);
}

html[data-theme="dark"] .strength-bar-wrap {
    background: #4a5568;
}

html[data-theme="dark"] .result-msg {
    background: #1e3a2e;
    border-color: #2e5e44;
    color: #6fcf97;
}

html[data-theme="dark"] #theme-toggle:hover {
    background: rgba(255,255,255,.1);
}
html[data-theme="dark"] .input-wrapper input,
html[data-theme="dark"] .pass-wrapper input[type="password"],
html[data-theme="dark"] .pass-wrapper input[type="text"] {
    background: #3a4355;
    color: #d0d6e0;
    border-color: #4a5568;
}

@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) {
        --bg-color:      #2b3140;
        --card-bg:       #343d52;
        --primary:       #4a90d9;
        --primary-hover: #3a7fc1;
        --text-muted:    #8b96a8;
        --border-color:  #4a5568;
        --input-bg:      #3a4355;
        --input-border:  #4a5568;
        --input-focus:   #6a9fd8;
    }
    html:not([data-theme="light"]) body { color: #d0d6e0; }
    html:not([data-theme="light"]) .input-wrapper .domain { background: #404857; color: #a0aab8; }
    html:not([data-theme="light"]) .toggle-pass           { background: #404857; border-color: #4a5568; }
    html:not([data-theme="light"]) .eye-icon              { filter: invert(1) brightness(0.8); }
    html:not([data-theme="light"]) .result-msg            { background: #1e3a2e; border-color: #2e5e44; color: #6fcf97; }
    html:not([data-theme="light"]) .input-wrapper input,
    html:not([data-theme="light"]) .pass-wrapper input[type="password"],
    html:not([data-theme="light"]) .pass-wrapper input[type="text"] {
        background: #3a4355;
        color: #d0d6e0;
        border-color: #4a5568;
}


}
