/* Custom Keycloak Login Theme CSS - Dark Modern Design */

/* Root variables for easy brand customization */

/* Title */
/*#kc-page-title::after {
    content: " to "
}*/

:root {
    --brand-primary: #3b82f6;
    --brand-primary-hover: #2563eb;
    --brand-secondary: #6b7280;
    --brand-success: #10b981;
    --brand-danger: #ef4444;
    --brand-warning: #f59e0b;
    --brand-info: #06b6d4;
    --brand-light: #f9fafb;
    --brand-dark: #111827;
    --brand-gray-50: #f9fafb;
    --brand-gray-100: #f3f4f6;
    --brand-gray-200: #e5e7eb;
    --brand-gray-300: #d1d5db;
    --brand-gray-400: #9ca3af;
    --brand-gray-500: #6b7280;
    --brand-gray-600: #4b5563;
    --brand-gray-700: #374151;
    --brand-gray-800: #1f2937;
    --brand-gray-900: #111827;
    --brand-white: #ffffff;
    --page-bg-color: #1A4F74;
    --mask-bg: #F4F6FC;
    --login-text: #3D516E;
    --native-dark-bg-color: #3D3D3D;

    --brand-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --box-shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Global Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--brand-font-family);
    background: var(--brand-gray-900);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    color: var(--brand-gray-100);
}

.login-pf body {
    background: none;
}

/* Main container - horizontal layout */
.login-pf {
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    background: none !important;
}

/* Left side - Image container (50%) */
.side-image-container {
    flex: 1;
    flex-basis: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--page-bg-color);
    min-height: 100vh;
}

.side-image {
    max-width: 80%;
    max-height: 80%;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Right side - Login form container (50%) */
.login-form-container {
    flex: 1;
    display: flex;
    flex-basis: 50%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--mask-bg) !important;
    padding: 40px;
    box-sizing: border-box;
    min-height: 100vh;
}

/* Legacy compatibility */
.login-pf-page {
    display: flex;
    flex-direction: row;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
}

/* Container for logo + form - vertical layout */
#kc-container-wrapper {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Header customization */
#kc-header {
    padding: 0;
    margin:0;
    text-align: center;
}

#kc-header-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

/* Logo styling */
#kc-logo {
    margin-bottom: 8px;
}

.kc-logo-image {
    max-width: 255px;
    height: auto;
    width: auto;
}

/* Company name/title styling */
.kc-logo-text {
    margin-top: 8px;
}

.kc-logo-text-span {
    font-size: 28px;
    font-weight: 700;
    color: var(--brand-white);
    letter-spacing: -0.025em;
}

/* Header styling - centered and on top */
.login-pf-page-header {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    margin-bottom: 20px !important;
    text-align: center !important;
    margin:0;
}

/* Main card styling - centered with specific height */
.card-pf,
.login-pf-page .card-pf {
    padding: 48px !important;
    width: 100% !important;
    max-width: 400px !important;
    height: 595px !important;
    margin: 0 auto !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    box-sizing: border-box !important;
    background: transparent;
    border: none;
    border-radius: none;
    box-shadow: none;
}

/* Dark theme overrides */
html[native-dark-active] {
    --native-dark-bg-color: #3D3D3D;
}

html[native-dark-active] .login-form-container {
    background: #3D3D3D !important;
    background-color: #3D3D3D !important;
}

html[native-dark-active] .card-pf,
html[native-dark-active] .login-pf-page .card-pf {
    box-shadow: none !important;
}

/* Form header */
.login-pf-header h1,
#kc-page-title {
    color: var(--login-text);
    font-weight: 600;
}

/* Form styling */
#kc-form {
    margin-top: 0;
}

/* Form groups - use Keycloak classes */
.form-group,
.pf-c-form__group {
    margin-bottom: 24px !important;
}

/* Labels - use Keycloak classes */
.control-label,
.pf-c-form__label,
label {
    color: var(--brand-gray-200) !important;
    font-weight: 500 !important;
    font-size: 14px !important;
    margin-bottom: 8px !important;
    display: block !important;
}

/* Input fields - use Keycloak classes */
.form-control,
.pf-c-form-control,
input[type="text"],
input[type="password"],
input[type="email"] {
    width: 100% !important;
    padding: 16px !important;
    border: 1px solid var(--brand-gray-600) !important;
    border-radius: var(--border-radius-sm) !important;
    font-size: 16px !important;
    background-color: var(--brand-gray-700) !important;
    color: var(--brand-white) !important;
    transition: all 0.2s ease !important;
    box-sizing: border-box !important;
}

.form-control:focus,
.pf-c-form-control:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus {
    border-color: var(--brand-primary) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
    outline: none !important;
    background-color: var(--brand-gray-600) !important;
}

.form-control::placeholder,
.pf-c-form-control::placeholder,
input::placeholder {
    color: var(--brand-gray-400) !important;
}

/* Error styling */
.form-control.error,
.form-control[aria-invalid="true"] {
    border-color: var(--brand-danger);
    background-color: rgba(239, 68, 68, 0.1);
}

.kc-feedback-text,
.kc-input-error-text {
    color: var(--brand-danger);
    font-size: 13px;
    margin-top: 6px;
    display: block;
    font-weight: 500;
}

/* Button styling - use Keycloak classes */
.btn,
.pf-c-button,
input[type="submit"] {
    padding: 8px 24px !important;
    border-radius: var(--border-radius-sm) !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    transition: all 0.2s ease !important;
    border: none !important;
    cursor: pointer !important;
    text-decoration: none !important;
    display: inline-block !important;
    text-align: center !important;
    width: 350px !important;
    letter-spacing: 0.025em !important;
}

.btn-primary,
.pf-c-button.pf-m-primary,
input[type="submit"] {
    background-color: var(--brand-primary) !important;
    color: var(--brand-white) !important;
}

.btn-primary:hover,
.pf-c-button.pf-m-primary:hover,
input[type="submit"]:hover {
    background-color: var(--brand-primary-hover) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.4) !important;
}

.btn-primary:active,
.pf-c-button.pf-m-primary:active,
input[type="submit"]:active {
    transform: translateY(0) !important;
}

.btn-primary:focus,
.pf-c-button.pf-m-primary:focus,
input[type="submit"]:focus {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.4) !important;
}

/* Checkbox styling */
.checkbox {
    margin: 20px 0;
}

.checkbox label {
    display: flex;
    align-items: center;
    color: var(--brand-gray-200);
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
}

.checkbox input[type="checkbox"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    accent-color: var(--brand-primary);
}

/* Links */
a {
    color: var(--brand-primary);
    text-decoration: none;
    transition: color 0.2s ease;
    font-weight: 500;
}

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

/* Form options */
#kc-form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 24px 0;
    flex-wrap: wrap;
    gap: 12px;
}

.kc-form-options-wrapper {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

/* Alert messages - Dark theme */
.alert {
    padding: 16px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 24px;
    border: 1px solid transparent;
    font-weight: 500;
}

.alert-error,
.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: #fcd34d;
}

.alert-info {
    background-color: rgba(6, 182, 212, 0.1);
    border-color: rgba(6, 182, 212, 0.3);
    color: #67e8f9;
}

/* Registration link section */
#kc-registration {
    text-align: center;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--brand-gray-700);
}

#kc-registration span {
    color: var(--brand-gray-300);
    font-size: 14px;
}

/* Social providers - Dark theme */
#kc-social-providers {
    margin-top: 32px;
    text-align: center;
}

#kc-social-providers hr {
    margin: 24px 0;
    border: none;
    height: 1px;
    background-color: var(--brand-gray-700);
}

#kc-social-providers h4 {
    color: var(--brand-gray-400);
    font-size: 12px;
    font-weight: 600;
    margin: 16px 0;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.kc-social-links a,
.kc-form-social-account-list .kc-form-social-account-list-button {
    display: block;
    padding: 12px 16px;
    margin: 8px 0;
    border: 1px solid var(--brand-gray-600);
    border-radius: var(--border-radius-sm);
    background-color: var(--brand-gray-700);
    color: var(--brand-gray-200);
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
}

.kc-social-links a:hover,
.kc-form-social-account-list .kc-form-social-account-list-button:hover {
    background-color: var(--brand-gray-600);
    border-color: var(--brand-primary);
    color: var(--brand-white);
}

/* Additional dark theme adjustments */
#kc-content-wrapper {
    color: var(--brand-gray-100);
}

/* Keycloak-specific class overrides */
.login-pf-page {
    background: var(--brand-gray-900);
}

.login-pf-header {
    background: transparent;
}

.login-pf-signup {
    border-color: var(--brand-gray-700);
}

/* Input error messages */
.pf-c-alert {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* Responsive design */
@media (max-width: 768px) {
    .login-pf {
        flex-direction: column !important;
        height: 100vh !important;
        width: 100vw !important;
        background: var(--mask-bg) !important;
    }
    
    .side-image-container {
        display: none;
    }

    .login-form-container {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        background: var(--mask-bg) !important;
        padding: 40px;
        box-sizing: border-box;
        height: 100vh !important;
        width: 100% !important;
    }
}

/* Loading state */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Focus visible for accessibility */
.btn:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .form-control {
        border-width: 3px;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}