/**
 * CRM Brentasoft - Modern Login Page Styles
 * G Tech Group - 2024
 */

/* Root Variables */
:root {
    --primary-color: #008457;
    --primary-dark: #006d47;
    --primary-light: #00a86b;
    --secondary-color: #1e293b;
    --accent-color: #00a86b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --border-radius: 16px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 40px -10px rgba(0, 132, 87, 0.15), 0 10px 20px -5px rgba(0, 0, 0, 0.1);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
}

body.login_page {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
}

/* Subtle Background Pattern */
body.login_page::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 0% 0%, rgba(0, 132, 87, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 100% 100%, rgba(0, 132, 87, 0.05) 0%, transparent 50%);
    z-index: 0;
}

/* Login Wrapper */
.login_page_wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 20px;
    animation: fadeInUp 0.5s ease-out;
}

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

/* Login Card */
#login_card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    border: 1px solid rgba(0, 132, 87, 0.1);
}

.md-card-content {
    padding: 36px !important;
}

.md-card-content.large-padding {
    padding: 40px 36px !important;
}

/* Login Heading / Logo */
.login_heading {
    text-align: center;
    margin-bottom: 28px;
}

.login_heading img {
    max-width: 160px;
    height: auto;
    transition: transform 0.3s ease;
}

.login_heading img:hover {
    transform: scale(1.03);
}

/* Demo Credentials */
.demo-credentials {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #86efac;
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 24px;
    font-size: 13px;
    color: var(--text-primary);
}

.demo-credentials strong {
    color: var(--primary-color);
}

.demo-credentials .demo-title {
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.demo-credentials .demo-title::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.2); }
}

/* Form Styles */
.uk-form-stacked {
    margin-top: 0;
}

.uk-form-row {
    margin-bottom: 18px;
}

.uk-form-row label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

/* Input Styles */
.md-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    color: var(--text-primary);
    transition: all 0.2s ease;
    outline: none;
}

.md-input:hover {
    border-color: #cbd5e1;
}

.md-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 132, 87, 0.12);
}

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

/* Button Styles */
.md-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    letter-spacing: 0.02em;
}

.md-btn-block {
    width: 100%;
}

.md-btn-large {
    padding: 14px 28px;
    font-size: 15px;
}

.md-btn-small {
    padding: 10px 20px;
    font-size: 14px;
}

.md-btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 132, 87, 0.35);
}

.md-btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 132, 87, 0.4);
}

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

/* Social Login Buttons */
.social-login-btn {
    background: #fff;
    border: 2px solid #e2e8f0;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.social-login-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.social-login-btn.google-btn:hover {
    border-color: #ea4335;
    color: #ea4335;
}

.social-login-btn.microsoft-btn:hover {
    border-color: #00a4ef;
    color: #00a4ef;
}

/* Divider */
.login-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: var(--text-light);
    font-size: 13px;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.login-divider span {
    padding: 0 14px;
}

/* Alert Styles */
.uk-alert {
    padding: 12px 36px 12px 14px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-size: 14px;
    position: relative;
    border: none;
}

.uk-alert-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%) !important;
    color: #065f46 !important;
    border: 1px solid #6ee7b7;
}

.uk-alert-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%) !important;
    color: #991b1b !important;
    border: 1px solid #fca5a5;
}

.uk-alert-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%) !important;
    color: #92400e !important;
    border: 1px solid #fcd34d;
}

.uk-alert-close {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
}

/* Checkbox Styles */
.icheck-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icheck-inline input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.icheck-inline label {
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
}

/* Links */
.uk-margin-top a,
#login_help_show,
#password_reset_show,
#auth_login_help_show {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.uk-margin-top a:hover,
#login_help_show:hover,
#password_reset_show:hover,
#auth_login_help_show:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Help Panel */
#login_help,
#login_password_reset,
#auth_login_help {
    padding: 36px !important;
}

#login_help h2,
#login_password_reset h2,
#auth_login_help h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 14px;
}

#login_help p,
#auth_login_help p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 10px;
}

.back_to_login {
    opacity: 0.6;
    transition: opacity 0.2s;
}

.back_to_login:hover {
    opacity: 1;
}

/* reCAPTCHA */
.g-recaptcha {
    margin: 14px 0;
    transform: scale(0.95);
    transform-origin: 0 0;
}

/* 2FA Code Input */
input.numbers {
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 8px;
    padding: 14px;
}

/* QR Code */
#twofa_form img {
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    margin: 14px 0;
}

/* Footer Link to Admin */
.admin-link-container {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.admin-link-container a {
    color: var(--text-secondary);
    font-size: 13px;
    text-decoration: none;
    transition: color 0.2s;
}

.admin-link-container a:hover {
    color: var(--primary-color);
}

/* Responsive */
@media (max-width: 480px) {
    .login_page_wrapper {
        padding: 16px;
    }

    .md-card-content {
        padding: 28px 22px !important;
    }

    .md-card-content.large-padding {
        padding: 32px 22px !important;
    }

    .login_heading img {
        max-width: 140px;
    }

    .g-recaptcha {
        transform: scale(0.85);
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Loading State */
.md-btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.md-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Version Badge */
.version-badge {
    position: fixed;
    bottom: 16px;
    right: 16px;
    background: rgba(0, 132, 87, 0.1);
    color: var(--primary-color);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    z-index: 100;
}

/* Copyright */
.login-copyright {
    text-align: center;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid #e2e8f0;
    color: var(--text-light);
    font-size: 12px;
}

.login-copyright a {
    color: var(--primary-color);
    text-decoration: none;
}

.login-copyright a:hover {
    text-decoration: underline;
}

/* Admin Badge */
.admin-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.admin-badge svg {
    width: 14px;
    height: 14px;
}

/* QR Code Container */
.qr-code-container {
    text-align: center;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    margin: 16px 0;
}

.qr-code-container img {
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.qr-code-container p {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Disabled buttons */
.md-btn[disabled],
.md-btn.md-btn-primary[disabled] {
    opacity: 0.5 !important;
    pointer-events: none !important;
    cursor: not-allowed !important;
}
