/**
 * EtiaKorp Custom Keycloak Theme
 * Brand Guide Compliant Styling
 * Designer: Sara Rodrigues | April 2023
 */

/* Import Google Fonts - Space Grotesk (primary) and Work Sans (secondary) */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Work+Sans:wght@300;400;500;600;700&display=swap');

/* ========================================
   EtiaKorp Color Palette (from Brand Guide)
   ======================================== */
:root {
    /* Primary Logo Colors */
    --etiakorp-blue-dark: #036090;      /* RGB(3, 97, 145) - Primary dark blue */
    --etiakorp-cyan: #03b5c3;           /* RGB(3, 181, 195) - Cyan accent */
    --etiakorp-navy: #1a1c38;           /* RGB(26, 28, 56) - Dark navy */

    /* Extended Palette */
    --etiakorp-teal: #247881;           /* RGB(36, 120, 129) */
    --etiakorp-teal-light: #43919B;     /* RGB(67, 145, 155) */
    --etiakorp-blue-light: #30AADD;     /* RGB(48, 170, 221) */
    --etiakorp-accent: #00FFC6;         /* RGB(0, 255, 198) - Bright accent */

    /* Neutral Colors */
    --etiakorp-white: #ffffff;
    --etiakorp-gray-light: #f5f5f5;
    --etiakorp-gray: #e0e0e0;
    --etiakorp-gray-dark: #757575;
    --etiakorp-black: #000000;

    /* Typography */
    --font-primary: 'Space Grotesk', sans-serif;
    --font-secondary: 'Work Sans', sans-serif;
}

/* ========================================
   Global Styles
   ======================================== */
body {
    font-family: var(--font-secondary);
    background: linear-gradient(135deg, var(--etiakorp-blue-dark) 0%, var(--etiakorp-navy) 100%);
    color: var(--etiakorp-navy);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* ========================================
   Login Container
   ======================================== */
#kc-container-wrapper {
    background: transparent;
}

.login-pf-page {
    background: transparent;
}

#kc-header {
    display: none;
}

#kc-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* ========================================
   Header with Logo
   ======================================== */
#kc-header-wrapper {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0 1rem;
}

#kc-logo {
    display: block;
    margin: 0 auto 1rem;
    width: 280px;
    height: auto;
}

#kc-logo-wrapper {
    background-color: transparent;
    padding: 0;
}

/* Custom logo styling */
.kc-logo-text {
    display: none; /* Hide default Keycloak text */
}

/* Add EtiaKorp logo */
#kc-header-wrapper::before {
    content: '';
    display: block;
    width: 280px;
    height: 100px;
    margin: 0 auto 1.5rem;
    background-image: url('../img/logo-white.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* ========================================
   Card Container
   ======================================== */
#kc-content {
    background: var(--etiakorp-white);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    padding: 3rem 2.5rem;
}

#kc-content-wrapper {
    overflow: visible;
}

/* ========================================
   Typography
   ======================================== */
#kc-page-title {
    font-family: var(--font-primary);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--etiakorp-navy);
    margin-bottom: 0.5rem;
    text-align: center;
}

.instruction {
    font-family: var(--font-secondary);
    font-size: 0.95rem;
    color: var(--etiakorp-gray-dark);
    text-align: center;
    margin-bottom: 2rem;
}

/* ========================================
   Form Elements
   ======================================== */
#kc-form {
    margin-top: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    font-family: var(--font-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--etiakorp-navy);
    margin-bottom: 0.5rem;
    display: block;
}

.input-group {
    position: relative;
}

input[type="text"],
input[type="password"],
input[type="email"] {
    font-family: var(--font-secondary);
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--etiakorp-gray);
    border-radius: 8px;
    background: var(--etiakorp-white);
    color: var(--etiakorp-navy);
    transition: all 0.3s ease;
    box-sizing: border-box;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus {
    outline: none;
    border-color: var(--etiakorp-cyan);
    box-shadow: 0 0 0 3px rgba(3, 181, 195, 0.1);
}

input[type="text"]::placeholder,
input[type="password"]::placeholder,
input[type="email"]::placeholder {
    color: var(--etiakorp-gray-dark);
}

/* ========================================
   Buttons
   ======================================== */
#kc-form-buttons {
    margin-top: 2rem;
}

button,
input[type="submit"],
.btn {
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 600;
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#kc-login,
button[type="submit"],
.btn-primary {
    background: linear-gradient(135deg, var(--etiakorp-blue-dark) 0%, var(--etiakorp-cyan) 100%);
    color: var(--etiakorp-white);
    border: none;
}

#kc-login:hover,
button[type="submit"]:hover,
.btn-primary:hover {
    background: linear-gradient(135deg, var(--etiakorp-cyan) 0%, var(--etiakorp-blue-dark) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(3, 96, 144, 0.3);
}

#kc-login:active,
button[type="submit"]:active,
.btn-primary:active {
    transform: translateY(0);
}

.btn-default,
.btn-secondary {
    background: transparent;
    color: var(--etiakorp-blue-dark);
    border: 2px solid var(--etiakorp-blue-dark);
}

.btn-default:hover,
.btn-secondary:hover {
    background: var(--etiakorp-blue-dark);
    color: var(--etiakorp-white);
}

/* ========================================
   Links
   ======================================== */
a {
    color: var(--etiakorp-blue-dark);
    text-decoration: none;
    font-family: var(--font-secondary);
    font-weight: 500;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--etiakorp-cyan);
    text-decoration: underline;
}

#kc-form-options {
    margin-top: 1.5rem;
    text-align: center;
}

#kc-registration {
    margin-top: 2rem;
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--etiakorp-gray);
}

#kc-registration span {
    font-family: var(--font-secondary);
    color: var(--etiakorp-gray-dark);
    font-size: 0.9rem;
}

/* ========================================
   Alerts and Messages
   ======================================== */
.alert {
    font-family: var(--font-secondary);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid;
}

.alert-success {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
}

.alert-warning {
    background: #fff3e0;
    border-color: #ff9800;
    color: #e65100;
}

.alert-error {
    background: #ffebee;
    border-color: #f44336;
    color: #c62828;
}

.alert-info {
    background: #e3f2fd;
    border-color: var(--etiakorp-blue-light);
    color: var(--etiakorp-blue-dark);
}

#kc-feedback {
    margin-bottom: 1.5rem;
}

/* ========================================
   Checkbox and Remember Me
   ======================================== */
.checkbox {
    margin: 1.5rem 0;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 0.5rem;
    accent-color: var(--etiakorp-cyan);
    cursor: pointer;
}

.checkbox label {
    display: inline;
    font-weight: 400;
    cursor: pointer;
}

/* ========================================
   Social Login
   ======================================== */
#kc-social-providers {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--etiakorp-gray);
}

#kc-social-providers ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#kc-social-providers li {
    margin-bottom: 0.75rem;
}

#kc-social-providers a {
    display: block;
    padding: 0.875rem 1rem;
    border: 2px solid var(--etiakorp-gray);
    border-radius: 8px;
    text-align: center;
    font-family: var(--font-primary);
    font-weight: 600;
    transition: all 0.3s ease;
}

#kc-social-providers a:hover {
    border-color: var(--etiakorp-cyan);
    background: rgba(3, 181, 195, 0.05);
    text-decoration: none;
}

/* ========================================
   Info Area (Footer)
   ======================================== */
#kc-info {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--etiakorp-gray);
    text-align: center;
}

#kc-info-wrapper {
    font-family: var(--font-secondary);
    font-size: 0.85rem;
    color: var(--etiakorp-gray-dark);
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 768px) {
    #kc-container {
        padding: 1rem;
    }

    #kc-content {
        padding: 2rem 1.5rem;
    }

    #kc-page-title {
        font-size: 1.5rem;
    }

    #kc-header-wrapper::before {
        width: 220px;
        height: 80px;
    }
}

@media (max-width: 480px) {
    #kc-content {
        padding: 1.5rem 1rem;
    }

    button,
    input[type="submit"],
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
    }
}

/* ========================================
   Loading State
   ======================================== */
.kc-loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

.kc-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid var(--etiakorp-gray);
    border-top-color: var(--etiakorp-cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   Accessibility
   ======================================== */
*:focus-visible {
    outline: 2px solid var(--etiakorp-cyan);
    outline-offset: 2px;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
