/* HQV Enterprise Mail - Custom Styles */
/* Extends: elastic skin */

:root {
    --hqv-primary: #174785;
    --hqv-secondary: #2c5282;
    --hqv-accent: #3182ce;
    --hqv-light: #ebf8ff;
    --hqv-text: #2d3748;
    --hqv-text-muted: #718096;
    --hqv-bg: #f7fafc;
    --hqv-white: #ffffff;
    --hqv-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --hqv-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* ========================================
   Gmail-style Split Login Layout
   ======================================== */

/* Ensure full height on login page */
html, body.task-login {
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

body.task-login #layout {
    height: 100% !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
}

#layout-content.hqv-login-split {
    display: flex !important;
    flex-direction: row !important;
    flex: 1 !important;
    min-height: 100vh;
    height: 100% !important;
    width: 100% !important;
    background: var(--hqv-bg, #f7fafc);
    padding: 0 !important;
    margin: 0 !important;
}

/* Left Panel - Branding */
.hqv-login-left {
    flex: 0 0 45%;
    background: linear-gradient(135deg, var(--hqv-primary, #174785) 0%, var(--hqv-secondary, #2c5282) 50%, var(--hqv-accent, #3182ce) 100%);
    display: flex !important;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    min-height: 100vh;
}

.hqv-login-branding {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 200px;
    color: #ffffff;
    top: auto !important;
}

.hqv-branding-content {
    position: relative;
    z-index: 3;
}

.hqv-logo-wrapper {
    margin-bottom: 30px;
}

.hqv-logo-wrapper img,
.hqv-logo-wrapper #logo {
    max-width: 180px;
    max-height: 100px;
    transition: transform 0.3s ease;
}

.hqv-logo-wrapper:hover img,
.hqv-logo-wrapper:hover #logo {
    transform: scale(1.05);
}

/* Custom logo from branding plugin - don't invert */
.hqv-branding-logo img {
    filter: none !important;
    max-width: 200px;
    max-height: 120px;
    margin-bottom: 20px;
}

/* Custom logo in split layout */
.hqv-has-custom-logo img,
.hqv-logo-wrapper .hqv-custom-logo {
    filter: none !important;
    max-width: 200px;
    max-height: 120px;
    border-radius: 8px;
}

.hqv-welcome-text {
    font-size: 2.5rem;
    font-weight: 300;
    margin: 0 0 15px 0;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.hqv-welcome-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin: 0;
    font-weight: 300;
}

.hqv-branding-slogan {
    margin-top: 20px;
    font-size: 1rem;
    font-style: italic;
    opacity: 0.85;
}

/* Decorative circles with rotating animation */
.hqv-branding-decoration {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    z-index: 1;
}

.hqv-circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
}

.hqv-circle-1 {
    width: 300px;
    height: 300px;
    animation: circleOrbit1 20s linear infinite;
}

.hqv-circle-2 {
    width: 200px;
    height: 200px;
    animation: circleOrbit2 25s linear infinite;
}

.hqv-circle-3 {
    width: 150px;
    height: 150px;
    animation: circleOrbit3 30s linear infinite;
}

/* Circle 1: Large orbit with shape & size morphing */
@keyframes circleOrbit1 {
    0% {
        top: -100px;
        left: -100px;
        transform: rotate(0deg) scale(1);
        border-radius: 50%;
    }
    15% {
        top: 15%;
        left: 20%;
        transform: rotate(54deg) scale(0.6);
        border-radius: 35%;
    }
    30% {
        top: 30%;
        left: 35%;
        transform: rotate(108deg) scale(1.3);
        border-radius: 20%;
    }
    50% {
        top: 60%;
        left: 10%;
        transform: rotate(180deg) scale(0.8);
        border-radius: 50%;
    }
    65% {
        top: 45%;
        left: 25%;
        transform: rotate(234deg) scale(1.1);
        border-radius: 10%;
    }
    80% {
        top: 25%;
        left: -30px;
        transform: rotate(288deg) scale(0.7);
        border-radius: 40%;
    }
    100% {
        top: -100px;
        left: -100px;
        transform: rotate(360deg) scale(1);
        border-radius: 50%;
    }
}

/* Circle 2: Medium orbit with shape & size morphing */
@keyframes circleOrbit2 {
    0% {
        bottom: -50px;
        right: -50px;
        top: auto;
        left: auto;
        transform: rotate(0deg) scale(1);
        border-radius: 50%;
    }
    12% {
        bottom: 30%;
        right: 20%;
        top: auto;
        left: auto;
        transform: rotate(-43deg) scale(1.4);
        border-radius: 30%;
    }
    28% {
        bottom: 55%;
        right: 35%;
        top: auto;
        left: auto;
        transform: rotate(-100deg) scale(0.6);
        border-radius: 5%;
    }
    45% {
        bottom: 70%;
        right: 10%;
        top: auto;
        left: auto;
        transform: rotate(-162deg) scale(1.2);
        border-radius: 45%;
    }
    60% {
        bottom: 50%;
        right: 40%;
        top: auto;
        left: auto;
        transform: rotate(-216deg) scale(0.75);
        border-radius: 25%;
    }
    78% {
        bottom: 25%;
        right: 15%;
        top: auto;
        left: auto;
        transform: rotate(-280deg) scale(1.15);
        border-radius: 50%;
    }
    100% {
        bottom: -50px;
        right: -50px;
        top: auto;
        left: auto;
        transform: rotate(-360deg) scale(1);
        border-radius: 50%;
    }
}

/* Circle 3: Drifting pattern with shape & size morphing */
@keyframes circleOrbit3 {
    0% {
        top: 50%;
        right: 20%;
        left: auto;
        transform: translateY(-50%) rotate(0deg) scale(1);
        border-radius: 50%;
    }
    14% {
        top: 20%;
        right: 35%;
        left: auto;
        transform: translateY(0) rotate(50deg) scale(1.5);
        border-radius: 40%;
    }
    28% {
        top: 10%;
        right: 10%;
        left: auto;
        transform: translateY(0) rotate(100deg) scale(0.5);
        border-radius: 15%;
    }
    42% {
        top: 35%;
        right: 5%;
        left: auto;
        transform: translateY(0) rotate(151deg) scale(1.3);
        border-radius: 50%;
    }
    57% {
        top: 60%;
        right: 30%;
        left: auto;
        transform: translateY(0) rotate(205deg) scale(0.65);
        border-radius: 25%;
    }
    71% {
        top: 75%;
        right: 15%;
        left: auto;
        transform: translateY(0) rotate(256deg) scale(1.25);
        border-radius: 8%;
    }
    85% {
        top: 65%;
        right: 40%;
        left: auto;
        transform: translateY(0) rotate(306deg) scale(0.85);
        border-radius: 35%;
    }
    100% {
        top: 50%;
        right: 20%;
        left: auto;
        transform: translateY(-50%) rotate(360deg) scale(1);
        border-radius: 50%;
    }
}

/* Right Panel - Form */
.hqv-login-right {
    flex: 1 1 55%;
    position: relative !important;
    padding: 40px;
    background: #f7fafc !important;
    min-height: 100vh;
}

.hqv-login-form-wrapper {
    width: 100%;
    max-width: 400px;
    background: #ffffff !important;
    border-radius: 16px;
    padding: 48px 40px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, calc(-50% - 50px)) !important;
}

.hqv-form-header {
    text-align: center;
    margin-bottom: 32px;
}

.hqv-form-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: #2d3748 !important;
    margin: 0 0 8px 0;
}

.hqv-form-subtitle {
    font-size: 0.95rem;
    color: #718096 !important;
    margin: 0;
}

/* Form styling */
.hqv-form .form-group,
.hqv-login-form-wrapper .form-group {
    margin-bottom: 20px;
}

.hqv-form .form-group label,
.hqv-login-form-wrapper .form-group label,
.hqv-login-form-wrapper label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #2d3748 !important;
    margin-bottom: 8px;
}

/* Override elastic #login-form positioning */
#login-form {
    top: 0 !important;
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
}

/* Input group styling - elastic uses td.input-group structure */
#login-form .input-group,
#login-form td.input-group {
    display: flex !important;
    background: #ffffff !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 10px !important;
    overflow: hidden;
    margin-bottom: 16px;
}

#login-form .input-group-prepend,
#login-form .input-group-text {
    background: #f7fafc !important;
    border: none !important;
    color: #718096 !important;
    display: flex !important;
    align-items: center !important;
}

#login-form .input-group .form-control,
#login-form input[type="text"],
#login-form input[type="password"] {
    flex: 1 !important;
    padding: 12px 16px !important;
    font-size: 1rem !important;
    border: none !important;
    border-radius: 0 !important;
    background: #ffffff !important;
    color: #2d3748 !important;
    box-shadow: none !important;
}

#login-form .input-group:focus-within {
    border-color: #174785 !important;
    box-shadow: 0 0 0 3px rgba(23, 71, 133, 0.15) !important;
}

#login-form input:focus {
    outline: none !important;
    box-shadow: none !important;
}

#login-form input::placeholder {
    color: #a0aec0 !important;
}

/* Login button */
#login-form input[type="submit"],
#login-form button[type="submit"],
#login-form .button.mainaction,
.hqv-form input[type="submit"],
.hqv-form button[type="submit"] {
    width: 100% !important;
    padding: 14px 24px !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    background: linear-gradient(135deg, #174785 0%, #2c5282 100%) !important;
    border: none !important;
    border-radius: 10px !important;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

#login-form input[type="submit"]:hover,
#login-form button[type="submit"]:hover,
.hqv-form input[type="submit"]:hover {
    background: linear-gradient(135deg, #2c5282 0%, #174785 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(23, 71, 133, 0.4) !important;
}

#login-form input[type="submit"]:active,
.hqv-form input[type="submit"]:active {
    transform: translateY(0);
}

/* Footer */
.hqv-footer {
    margin-top: 24px;
    text-align: center;
}

.hqv-footer .support-link {
    color: var(--hqv-primary, #174785);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.hqv-footer .support-link:hover {
    color: var(--hqv-accent, #3182ce);
    text-decoration: underline;
}

.hqv-copyright {
    position: absolute !important;
    bottom: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    color: #718096 !important;
    font-size: 0.8rem;
    text-align: center;
}

/* Forgot password and other login sub-pages */
#layout-content.hqv-login {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 100vh;
    background: linear-gradient(135deg, #174785 0%, #2c5282 50%, #3182ce 100%) !important;
}

.hqv-login-container {
    width: 100%;
    max-width: 420px;
    background: #ffffff !important;
    border-radius: 16px;
    padding: 48px 40px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    margin: 20px;
    position: relative;
    z-index: 1;
}

.hqv-login-header {
    text-align: center;
    margin-bottom: 24px;
    position: relative !important;
}

.hqv-login-header #logo,
.hqv-login-header img,
.task-login #logo {
    position: relative !important;
    top: auto !important;
    max-width: 150px;
    max-height: 60px;
    margin-bottom: 16px;
}

.hqv-login-header .hqv-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0;
}

/* Forgot password form - stack label and input */
.hqv-login-container .form-group.row {
    display: block !important;
    margin-bottom: 20px;
}

.hqv-login-container .form-group.row label {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2d3748;
}

.hqv-login-container .form-group.row .col-sm-9,
.hqv-login-container .form-group.row div[class*="col-"] {
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    padding: 0 !important;
}

.hqv-login-container .form-group.row .offset-sm-3,
.hqv-login-container .form-group.row [class*="offset-"] {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    padding: 0 !important;
}

.hqv-login-container .form-control {
    width: 100% !important;
    padding: 12px 16px !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 10px !important;
    background: #ffffff !important;
    color: #1a202c !important;
    font-weight: 500 !important;
}

.hqv-login-container .form-control:focus,
html.dark-mode .hqv-login-container .form-control:focus,
html.dark-mode .hqv-login-container .form-control:focus:not(.is-invalid) {
    border-color: #174785 !important;
    box-shadow: 0 0 0 3px rgba(23, 71, 133, 0.15) !important;
    color: #000000 !important;
    background: #ffffff !important;
}

.hqv-login-container .btn,
.hqv-login-container button[type="submit"] {
    width: 100% !important;
    padding: 14px 24px !important;
    background: linear-gradient(135deg, #174785 0%, #2c5282 100%) !important;
    border: none !important;
    border-radius: 10px !important;
    color: #ffffff !important;
    font-weight: 600 !important;
}

/* ========================================
   Branding Plugin Integration
   ======================================== */

/* Logo from branding plugin */
.hqv-branding-header {
    text-align: center;
    margin-bottom: 20px;
}

.hqv-branding-header .hqv-branding-logo {
    margin-bottom: 15px;
}

.hqv-branding-header .hqv-branding-logo img {
    max-width: 160px;
    max-height: 80px;
}

.hqv-branding-header .hqv-branding-slogan {
    color: var(--hqv-text-muted, #718096);
    font-size: 0.95rem;
    font-style: italic;
}

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

@media (max-width: 1024px) {
    .hqv-login-left {
        flex: 0 0 40%;
    }

    .hqv-welcome-text {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    #layout-content.hqv-login-split {
        flex-direction: row !important;
        position: relative !important;
    }

    .hqv-login-left {
        flex: 1 1 100% !important;
        min-height: 100vh !important;
        padding: 30px 20px;
        align-items: flex-start !important;
    }

    .hqv-login-branding {
        padding: 30px 20px 20px 20px;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
    }

    .hqv-branding-content {
        position: relative;
        z-index: 10;
        margin-bottom: 20px;
    }

    .hqv-logo-wrapper {
        margin-bottom: 0 !important;
    }

    .hqv-logo-wrapper img,
    .hqv-logo-wrapper #logo {
        max-width: 120px;
        max-height: 60px;
    }

    .hqv-welcome-text {
        display: none !important;
    }

    .hqv-welcome-subtitle {
        display: none !important;
    }

    .hqv-branding-slogan {
        margin-top: 10px;
    }

    .hqv-circle-1 {
        width: 150px;
        height: 150px;
    }

    .hqv-circle-2 {
        width: 100px;
        height: 100px;
    }

    .hqv-circle-3 {
        display: none;
    }

    .hqv-login-right {
        position: absolute !important;
        width: 100% !important;
        height: auto !important;
        top: 180px !important;
        left: 0 !important;
        bottom: 0 !important;
        background: transparent !important;
        display: flex !important;
        align-items: flex-start !important;
        justify-content: center !important;
        padding: 20px;
        padding-top: 0;
    }

    .hqv-login-form-wrapper {
        padding: 32px 24px;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: blur(10px);
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2) !important;
        position: static !important;
        transform: none !important;
    }

    .hqv-form-title {
        font-size: 1.5rem;
    }

    .hqv-copyright {
        display: none;
    }
}

@media (max-width: 480px) {
    .hqv-login-left {
        min-height: 100vh !important;
    }

    .hqv-login-form-wrapper {
        padding: 24px 20px;
        margin: 10px;
        max-width: calc(100% - 20px);
    }

    .hqv-form input[type="text"],
    .hqv-form input[type="password"],
    .hqv-form .form-control {
        padding: 10px 14px;
    }
}

/* ========================================
   Other Page Styles
   ======================================== */

/* S/MIME/Security icon in settings */
.listing.iconized li.smime > a:before,
.listing.iconized li.certificates > a:before,
.listing.iconized li.security > a:before {
    content: "\f023";
}

/* Primary color overrides for main app */
#layout-menu,
.toolbar.menu {
    background-color: var(--hqv-primary, #174785) !important;
}

.button.primary,
button.mainaction:not(.hqv-form button),
input[type='submit'].mainaction:not(.hqv-form input) {
    background-color: var(--hqv-primary, #174785) !important;
    border-color: var(--hqv-primary, #174785) !important;
}

.button.primary:hover,
button.mainaction:hover:not(.hqv-form button) {
    background-color: var(--hqv-secondary, #2c5282) !important;
    border-color: var(--hqv-secondary, #2c5282) !important;
}

/* Link colors */
a:not(.button):not(.hqv-form a) {
    color: var(--hqv-link, var(--hqv-primary, #174785));
}

/* Sidebar selected */
#layout-sidebar .listing li.selected,
#layout-sidebar .listing li.focused {
    background-color: var(--hqv-primary, #174785) !important;
}

/* ========================================
   Dark Mode Support (if enabled)
   ======================================== */

@media (prefers-color-scheme: dark) {
    .hqv-login-right {
        background: #1a202c;
    }

    .hqv-login-form-wrapper {
        background: #2d3748;
    }

    .hqv-form-title {
        color: #f7fafc;
    }

    .hqv-form-subtitle {
        color: #a0aec0;
    }

    .hqv-form input[type="text"],
    .hqv-form input[type="password"],
    .hqv-form .form-control {
        background: #4a5568;
        border-color: #4a5568;
        color: #f7fafc;
    }

    .hqv-copyright {
        color: #a0aec0;
    }
}
