/**
 * Roundcube login — split layout with brand panel + entrance animations
 */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,600;0,700;1,300&family=DM+Sans:wght@400;500;600&display=swap');

/* ===== Entrance keyframes ===== */
@keyframes fade-up {
    from { opacity: 0; transform: translateY(22px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes line-draw {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

@keyframes card-enter {
    from { opacity: 0; transform: translate(-50%, calc(-50% + 28px)); }
    to   { opacity: 1; transform: translate(-50%, -50%); }
}

@keyframes form-stagger {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
    0%   { background-position: -200% center; }
    100% { background-position: 200% center; }
}

/* ===== Reset skin defaults on login ===== */
body.task-login {
    background: #f8f8f7 !important;
    min-height: 100vh;
    overflow: hidden !important;
    font-family: 'DM Sans', -apple-system, "Segoe UI", sans-serif;
}

body.task-login #layout {
    background: transparent !important;
    overflow: visible !important;
    display: block !important;
}

body.task-login #layout > div {
    background: transparent !important;
}

/* ===== Brand panel — left half ===== */
#brand-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 50vw;
    height: 100vh;
    overflow: hidden;
    background: linear-gradient(160deg, #101520 0%, #1a2235 45%, #151c2c 100%);
    z-index: 10;
    animation: fade-in 0.8s ease-out both;
}

/* Grain texture overlay for depth */
#brand-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 3;
    opacity: 0.035;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 128px 128px;
}

.brand-content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 8vw;
}

.brand-line {
    width: 40px;
    height: 2px;
    background: linear-gradient(90deg, rgba(168, 196, 224, 0.8), transparent);
    margin-bottom: 32px;
    transform-origin: left center;
    animation: line-draw 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both;
}

.brand-name {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-size: clamp(52px, 5.5vw, 84px);
    font-weight: 700;
    line-height: 0.92;
    letter-spacing: 0.04em;
    color: #f0f0ee;
    margin: 0;
    animation: fade-up 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.45s both;
}

.brand-sub {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-size: clamp(28px, 3vw, 48px);
    font-weight: 300;
    font-style: italic;
    letter-spacing: 0.06em;
    color: #a8c4e0;
    opacity: 0.8;
    margin: 8px 0 0 0;
    animation: fade-up 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.6s both;
}

.brand-tagline {
    margin: 48px 0 0 0;
    color: rgba(240, 240, 238, 0.35);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    font-family: 'DM Sans', -apple-system, sans-serif;
    animation: fade-in 0.8s ease 0.9s both;
}

.brand-footer {
    position: absolute;
    bottom: 28px;
    left: 8vw;
    color: rgba(240, 240, 238, 0.2);
    font-size: 11px;
    letter-spacing: 0.08em;
    z-index: 2;
    animation: fade-in 0.8s ease 1.1s both;
}

/* ===== Floating orbs ===== */
.orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    animation-fill-mode: both;
}

.orb-1 {
    width: 480px;
    height: 480px;
    top: -12%;
    left: -8%;
    background: radial-gradient(circle, rgba(100, 160, 220, 0.18) 0%, transparent 70%);
    filter: blur(40px);
    animation: drift-1 24s ease-in-out infinite, fade-in 1.5s ease 0.2s both;
}

.orb-2 {
    width: 360px;
    height: 360px;
    bottom: -8%;
    right: -5%;
    background: radial-gradient(circle, rgba(200, 175, 140, 0.12) 0%, transparent 70%);
    filter: blur(50px);
    animation: drift-2 30s ease-in-out infinite, fade-in 1.5s ease 0.5s both;
}

.orb-3 {
    width: 280px;
    height: 280px;
    top: 45%;
    left: 35%;
    background: radial-gradient(circle, rgba(140, 190, 230, 0.10) 0%, transparent 70%);
    filter: blur(45px);
    animation: drift-3 20s ease-in-out infinite, fade-in 1.5s ease 0.8s both;
}

@keyframes drift-1 {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(40px, 60px); }
    66% { transform: translate(-20px, 30px); }
}

@keyframes drift-2 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-40px, -50px); }
}

@keyframes drift-3 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, -40px) scale(1.1); }
}

/* ===== Login card — centered in right half ===== */
body.task-login #layout-content {
    position: fixed !important;
    top: 50% !important;
    left: calc(50vw + 25vw) !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 2px 24px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.03);
    padding: 44px 48px 36px !important;
    width: 380px;
    max-width: calc(50vw - 80px);
    display: block !important;
    height: auto !important;
    min-height: unset !important;
    z-index: 10;
    animation: card-enter 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.25s both;
}

/* ===== Card header ===== */
#login-logo-text {
    font-family: 'DM Sans', -apple-system, sans-serif;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #1a1d2e;
    margin: 0 0 4px 0;
    text-align: left;
    animation: form-stagger 0.5s ease-out 0.5s both;
}

#login-sub {
    font-family: 'DM Sans', -apple-system, sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #8a8a86;
    margin: 0 0 32px 0;
    text-align: left;
    animation: form-stagger 0.5s ease-out 0.6s both;
}

/* ===== Form reset ===== */
body.task-login #login-form {
    margin: 0 !important;
    padding: 0 !important;
    top: 0 !important;
    position: static !important;
    width: 100% !important;
    max-width: none !important;
    animation: form-stagger 0.5s ease-out 0.7s both;
}

body.task-login #login-form,
body.task-login form.propform {
    margin: 0 !important;
    padding: 0 !important;
}

/* ===== Labels ===== */
body.task-login label {
    color: #5a5a56;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.01em;
    margin-bottom: 6px;
    font-family: 'DM Sans', -apple-system, sans-serif;
}

/* ===== Inputs ===== */
body.task-login .form-control,
body.task-login input[type="text"],
body.task-login input[type="password"] {
    border: 1.5px solid #e0e0dc;
    border-radius: 8px;
    background: #fafaf9;
    color: #1a1d2e;
    font-size: 15px;
    font-family: 'DM Sans', -apple-system, sans-serif;
    padding: 11px 14px;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease,
                transform 0.2s ease;
    box-shadow: none;
}

body.task-login .form-control:hover,
body.task-login input[type="text"]:hover,
body.task-login input[type="password"]:hover {
    border-color: #c8c8c4;
}

body.task-login .form-control:focus,
body.task-login input[type="text"]:focus,
body.task-login input[type="password"]:focus {
    border-color: #8ab4d8;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(138, 180, 216, 0.15);
    outline: none;
    transform: scale(1.01);
}

/* ===== Submit button ===== */
body.task-login button[type="submit"],
body.task-login input[type="submit"],
body.task-login .btn-primary {
    background: #1a2235;
    border: none;
    border-radius: 8px;
    color: #f0f0ee;
    font-size: 15px;
    font-weight: 500;
    font-family: 'DM Sans', -apple-system, sans-serif;
    padding: 12px 0;
    width: 100%;
    cursor: pointer;
    transition: background 0.25s ease, transform 0.2s ease, box-shadow 0.3s ease;
    letter-spacing: 0.01em;
    margin-top: 8px;
    position: relative;
    overflow: hidden;
}

/* Shimmer highlight on hover */
body.task-login button[type="submit"]::after,
body.task-login .btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        transparent 35%,
        rgba(255, 255, 255, 0.08) 45%,
        rgba(255, 255, 255, 0.12) 50%,
        rgba(255, 255, 255, 0.08) 55%,
        transparent 65%
    );
    background-size: 200% 100%;
    background-position: -200% center;
    transition: none;
    pointer-events: none;
}

body.task-login button[type="submit"]:hover,
body.task-login .btn-primary:hover {
    background: #253050;
    box-shadow: 0 6px 20px rgba(26, 34, 53, 0.22);
    transform: translateY(-1px);
}

body.task-login button[type="submit"]:hover::after,
body.task-login .btn-primary:hover::after {
    animation: shimmer 0.8s ease-out forwards;
}

body.task-login button[type="submit"]:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(26, 34, 53, 0.15);
}

/* ===== Form rows ===== */
body.task-login .propform .row,
body.task-login .propform .form-group,
body.task-login .propform tr {
    margin-bottom: 16px;
}

/* ===== Footer ===== */
body.task-login #login-footer {
    color: #b5b4af;
    font-size: 12px;
    font-family: 'DM Sans', -apple-system, sans-serif;
    margin-top: 24px;
    text-align: center;
    animation: fade-in 0.6s ease 0.9s both;
}

body.task-login #login-footer a {
    color: #8ab4d8;
    text-decoration: none;
    transition: color 0.2s ease;
}

body.task-login #login-footer a:hover {
    color: #5a9ac4;
    text-decoration: underline;
}

/* ===== Mobile: stack vertically ===== */
@media (max-width: 900px) {
    #brand-panel {
        position: fixed;
        width: 100vw;
        height: 28vh;
        min-height: 180px;
    }

    .brand-content {
        padding: 0 32px;
        justify-content: flex-end;
        padding-bottom: 24px;
    }

    .brand-name {
        font-size: 36px;
    }

    .brand-sub {
        font-size: 22px;
        margin-top: 4px;
    }

    .brand-tagline {
        margin-top: 16px;
        font-size: 10px;
    }

    .brand-line {
        margin-bottom: 20px;
    }

    .brand-footer {
        display: none;
    }

    body.task-login #layout-content {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
        width: 100vw;
        max-width: 100vw;
        border-radius: 20px 20px 0 0;
        padding: 36px 28px 32px !important;
        height: calc(72vh);
        overflow-y: auto;
        animation: none;
        opacity: 1;
    }
}
