/* ========================================
   Reset & Base Styles
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette - Ginseng Pedidos Brand Colors */
    --primary-color: #04506B;        /* Azul - Cor principal (80%) */
    --primary-hover: #036189;        /* Azul mais claro no hover */
    --primary-active: #033d52;       /* Azul mais escuro no active */
    --secondary-color: #739577;      /* Verde - Cor secundária */
    --accent-pink: #CC7277;          /* Rosa - Detalhes */
    --accent-purple: #6758A1;        /* Roxo - Detalhes */
    --background-color: #f5f5f5;
    --card-background: #ffffff;
    --text-primary: #04506B;         /* Texto principal usa o azul */
    --text-secondary: #04506B;       /* Texto secundário também azul */
    --text-light: #739577;           /* Texto claro usa verde */
    --border-color: #e1dfdd;
    --error-color: #CC7277;          /* Erro usa rosa */
    --success-color: #739577;        /* Sucesso usa verde */
    --focus-color: #04506B;          /* Focus usa azul */

    /* Spacing */
    --spacing-xs: 0.3rem;      /* 4.8px */
    --spacing-sm: 0.5rem;      /* 8px */
    --spacing-md: 0.75rem;     /* 12px */
    --spacing-lg: 1rem;        /* 16px */
    --spacing-xl: 1.5rem;      /* 24px */

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);

    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 250ms ease-in-out;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: linear-gradient(135deg, #04506B 0%, #036189 50%, #739577 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
}

/* ========================================
   Login Container
   ======================================== */
.login-container {
    width: 100%;
    max-width: 440px;
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-card {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 1.25rem;          /* 20px */
    position: relative;
}

/* ========================================
   Header Section
   ======================================== */
.login-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.logo-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;                /* 48px */
    height: 48px;               /* 48px */
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow-md);
}

.logo-icon {
    width: 24px;                /* 24px */
    height: 24px;               /* 24px */
    color: white;
}

.login-title {
    font-size: 1.2rem;          /* 19.2px */
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.login-subtitle {
    font-size: 0.85rem;         /* 13.6px */
    color: var(--text-secondary);
    font-weight: 400;
}

/* ========================================
   Form Styles
   ======================================== */
.login-form {
    margin-bottom: var(--spacing-lg);
}

.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    font-size: 0.8rem;          /* 12.8px */
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: var(--spacing-md);
    width: 16px;                /* 16px */
    height: 16px;               /* 16px */
    color: var(--text-light);
    pointer-events: none;
    z-index: 1;
}

.form-input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.5rem;  /* 8px 12px 8px 40px */
    font-size: 0.85rem;         /* 13.6px */
    color: var(--text-primary);
    background: var(--card-background);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
    outline: none;
}

.form-input::placeholder {
    color: var(--text-light);
}

.form-input:focus {
    border-color: var(--focus-color);
    box-shadow: 0 0 0 3px rgba(4, 80, 107, 0.15);
}

.form-input:hover:not(:focus) {
    border-color: var(--text-light);
}

/* Password Toggle Button */
.toggle-password {
    position: absolute;
    right: var(--spacing-md);
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--spacing-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: background-color var(--transition-fast);
}

.toggle-password:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.toggle-password:focus {
    outline: 2px solid var(--focus-color);
    outline-offset: 2px;
}

.eye-icon {
    width: 16px;                /* 16px */
    height: 16px;               /* 16px */
    color: var(--text-light);
}

/* Error Messages */
.error-message {
    display: block;
    font-size: 0.75rem;         /* 12px */
    color: var(--error-color);
    margin-top: var(--spacing-xs);
    min-height: 1rem;
}

/* ========================================
   Form Options (Remember Me & Forgot Password)
   ======================================== */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;                /* 16px */
    height: 16px;               /* 16px */
    margin-right: var(--spacing-xs);
    cursor: pointer;
    accent-color: var(--secondary-color);
}

.checkbox-text {
    font-size: 0.8rem;          /* 12.8px */
    color: var(--text-secondary);
}

.forgot-password {
    font-size: 0.8rem;          /* 12.8px */
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.forgot-password:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* ========================================
   Buttons
   ======================================== */
.btn-login {
    width: 100%;
    padding: 0.5rem 0.875rem;   /* 8px 14px */
    font-size: 0.85rem;         /* 13.6px */
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);     /* 4.8px */
    position: relative;
    overflow: hidden;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-text {
    display: inline-block;
}

.btn-loader {
    display: none;
}

.btn-login.loading .btn-text {
    display: none;
}

.btn-login.loading .btn-loader {
    display: inline-block;
}

/* Spinner Animation */
.spinner {
    width: 16px;                /* 16px */
    height: 16px;               /* 16px */
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.spinner-circle {
    stroke-dasharray: 50;
    stroke-dashoffset: 25;
}

/* ========================================
   Alert Messages
   ======================================== */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-top: var(--spacing-md);
    font-size: 0.8rem;          /* 12.8px */
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-error {
    background-color: #fef0f0;
    border: 1px solid #f8d7da;
    color: var(--error-color);
}

.alert-icon {
    width: 16px;                /* 16px */
    height: 16px;               /* 16px */
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-message {
    flex: 1;
    line-height: 1.5;
}

/* ========================================
   Divider
   ======================================== */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: var(--spacing-lg) 0;
    position: relative;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.divider-text {
    padding: 0 var(--spacing-md);
    font-size: 0.75rem;         /* 12px */
    color: var(--text-light);
    font-weight: 500;
}

/* ========================================
   Azure AD Button
   ======================================== */
.btn-azure {
    width: 100%;
    padding: 0.875rem 1.25rem;  /* 14px 20px - maior para destaque */
    font-size: 1rem;            /* 16px - maior */
    font-weight: 600;           /* mais bold */
    color: white;
    background: linear-gradient(135deg, #0078d4 0%, #005a9e 100%); /* Gradiente Microsoft */
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);     /* 8px */
    box-shadow: 0 4px 12px rgba(0, 120, 212, 0.3);
    margin-top: 1rem;
}

.btn-azure:hover {
    background: linear-gradient(135deg, #005a9e 0%, #004578 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 120, 212, 0.4);
}

.btn-azure:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 120, 212, 0.3);
}

.btn-azure:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.azure-icon {
    width: 20px;
    height: 20px;
    color: white;
}

.azure-icon {
    width: 16px;                /* 16px */
    height: 16px;               /* 16px */
    color: #04506B;
}

/* ========================================
   Footer
   ======================================== */
.login-footer {
    margin-top: var(--spacing-xl);
    text-align: center;
}

.footer-text {
    font-size: 0.75rem;         /* 12px */
    color: var(--text-light);
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 768px) {
    body {
        padding: var(--spacing-sm);
    }

    .login-card {
        padding: 1rem;          /* 16px */
    }

    .login-header {
        margin-bottom: var(--spacing-lg);
    }

    .login-title {
        font-size: 1.1rem;      /* 17.6px */
    }

    .login-subtitle {
        font-size: 0.8rem;      /* 12.8px */
    }

    .logo-container {
        width: 40px;            /* 40px */
        height: 40px;           /* 40px */
    }

    .logo-icon {
        width: 20px;            /* 20px */
        height: 20px;           /* 20px */
    }

    .form-group {
        margin-bottom: var(--spacing-md);
    }

    .form-label {
        font-size: 0.75rem;     /* 12px */
    }

    .form-input {
        padding: 0.4rem 0.6rem 0.4rem 2.25rem;  /* 6.4px 9.6px 6.4px 36px */
        font-size: 0.8rem;      /* 12.8px */
    }

    .input-icon {
        width: 14px;            /* 14px */
        height: 14px;           /* 14px */
        left: 0.6rem;           /* 9.6px */
    }

    .eye-icon {
        width: 14px;            /* 14px */
        height: 14px;           /* 14px */
    }

    .toggle-password {
        right: 0.6rem;          /* 9.6px */
    }

    .checkbox-label input[type="checkbox"] {
        width: 14px;            /* 14px */
        height: 14px;           /* 14px */
    }

    .checkbox-text,
    .forgot-password {
        font-size: 0.75rem;     /* 12px */
    }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-xs);
        margin-bottom: var(--spacing-md);
    }

    .btn-login,
    .btn-azure {
        padding: 0.4rem 0.75rem;  /* 6.4px 12px */
        font-size: 0.8rem;      /* 12.8px */
    }

    .spinner {
        width: 14px;            /* 14px */
        height: 14px;           /* 14px */
    }

    .alert {
        padding: 0.6rem;        /* 9.6px */
        gap: 0.4rem;            /* 6.4px */
        font-size: 0.75rem;     /* 12px */
    }

    .alert-icon {
        width: 14px;            /* 14px */
        height: 14px;           /* 14px */
    }

    .divider {
        margin: var(--spacing-md) 0;
    }

    .divider-text {
        font-size: 0.7rem;      /* 11.2px */
    }

    .azure-icon {
        width: 14px;            /* 14px */
        height: 14px;           /* 14px */
    }

    .footer-text {
        font-size: 0.7rem;      /* 11.2px */
    }
}

/* ========================================
   Accessibility & Focus States
   ======================================== */
*:focus-visible {
    outline: 2px solid var(--focus-color);
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   Brand Color Accents
   ======================================== */
/* Adiciona um sutil detalhe colorido no topo do card */
.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg,
        var(--primary-color) 0%,
        var(--primary-color) 80%,
        var(--secondary-color) 80%,
        var(--secondary-color) 90%,
        var(--accent-pink) 90%,
        var(--accent-purple) 95%
    );
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* Adiciona um gradiente sutil no hover do botão de login */
.btn-login::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(115, 149, 119, 0.1) 100%);
    opacity: 0;
    transition: opacity var(--transition-normal);
    border-radius: var(--radius-md);
}

.btn-login:hover::after {
    opacity: 1;
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    body {
        background: white;
    }

    .login-card {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }

    .btn-login,
    .btn-azure,
    .toggle-password {
        display: none;
    }
}
