/* MEBS - Ultra Professional Login System */
/* Color Scheme: White base, Blue primary, Yellow accents */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Poppins:wght@400;500;600;700;800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* White & Neutrals */
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* Blue Primary */
    --blue-50: #eff6ff;
    --blue-100: #dbeafe;
    --blue-500: #3b82f6;
    --blue-600: #2563eb;
    --blue-700: #1d4ed8;
    --blue-800: #1e40af;
    --blue-900: #1e3a8a;
    
    /* Yellow Accents */
    --yellow-400: #facc15;
    --yellow-500: #eab308;
    --yellow-600: #ca8a04;
    
    /* Status Colors */
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--gray-50);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
}

/* Dynamic body background - controlled by admin settings */
body[data-theme-bg] {
    background: var(--dynamic-bg, var(--gray-50));
}

/* Subtle animated background pattern */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(59, 130, 246, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(234, 179, 8, 0.03) 0%, transparent 50%);
    pointer-events: none;
}

/* Alert Messages */
.mebs-alert {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    max-width: 400px;
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 1000;
    animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid;
    font-weight: 500;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.mebs-alert-success {
    background: #f0fdf4;
    color: #166534;
    border-color: #86efac;
}

.mebs-alert-success i {
    color: var(--success);
}

.mebs-alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fca5a5;
}

.mebs-alert-error i {
    color: var(--error);
}

.mebs-alert i {
    font-size: 1.25rem;
}

/* Login Container */
.login-container {
    width: 100%;
    max-width: 1100px;
    display: grid;
    grid-template-columns: 45% 55%;
    gap: 0;
    background: var(--white);
    border-radius: 1.5rem;
    overflow: hidden;
    box-shadow: var(--shadow-2xl);
    position: relative;
    z-index: 1;
    border: 1px solid var(--gray-200);
}

/* Left Side - Branding */
.login-brand {
    background: linear-gradient(135deg, var(--blue-600) 0%, var(--blue-800) 100%);
    padding: 3.5rem 3rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    color: var(--white);
    position: relative;
    overflow: visible;
    gap: 2rem;
}

/* Dynamic brand background */
.login-brand[data-custom-bg] {
    background: var(--dynamic-brand-bg, linear-gradient(135deg, var(--blue-600) 0%, var(--blue-800) 100%));
}

/* Subtle gradient overlay */
.login-brand::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(250, 204, 21, 0.12) 0%, transparent 70%);
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.1); }
    66% { transform: translate(-30px, 30px) scale(0.9); }
}

/* Logo Section */
.brand-logo-modern {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
    position: relative;
    z-index: 1;
}

.logo-icon {
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--white);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.logo-mebs {
    font-size: 1.875rem;
    font-weight: 800;
    font-family: 'Poppins', sans-serif;
    letter-spacing: 1px;
    color: var(--white);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.logo-tagline {
    font-size: 0.75rem;
    opacity: 0.9;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--yellow-400);
}

/* Brand Logo Image */
.brand-logo-image {
    width: 100%;
    max-width: 300px;
    position: relative;
    z-index: 5;
    margin: 0 auto 1.5rem;
}

.brand-logo-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Company Name */
.company-name {
    position: relative;
    z-index: 5;
    text-align: center;
    width: 100%;
    margin-top: 1.5rem;
}

.company-name h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--white);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    font-family: 'Poppins', sans-serif;
}

.brand-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    margin: 0.5rem 0 0 0;
    font-weight: 500;
}

/* Analog Clock */
.analog-clock-container {
    text-align: center;
    position: relative;
    z-index: 5;
    width: 100%;
    margin: 0 auto 1.5rem;
}

.analog-clock {
    position: relative;
    margin: 0 auto;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.25));
}

.clock-face {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    position: relative;
    border: 8px solid var(--white);
    box-shadow: 
        inset 0 2px 8px rgba(0, 0, 0, 0.08),
        0 0 0 2px rgba(30, 58, 138, 0.3),
        0 10px 30px rgba(0, 0, 0, 0.2);
}

.clock-center {
    position: absolute;
    background: linear-gradient(135deg, var(--blue-600) 0%, var(--blue-700) 100%);
    border: 3px solid var(--white);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 15;
    box-shadow: 
        0 4px 12px rgba(30, 58, 138, 0.4),
        inset 0 1px 3px rgba(255, 255, 255, 0.4);
}

/* Scale clock center based on clock size */
.analog-clock[style*="width: 120px"] .clock-center {
    width: 10px;
    height: 10px;
}

.analog-clock[style*="width: 200px"] .clock-center {
    width: 16px;
    height: 16px;
}

.hand {
    position: absolute;
    bottom: 50%;
    left: 50%;
    transform-origin: bottom center;
    transition: transform 0.05s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* Scale hands for smaller clock */
.analog-clock[style*="width: 120px"] .hour-hand {
    width: 3px;
    height: 28px;
    margin-left: -1.5px;
    background: linear-gradient(to top, var(--gray-900), var(--gray-800));
    border-radius: 2px 2px 0 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.analog-clock[style*="width: 120px"] .minute-hand {
    width: 2.5px;
    height: 38px;
    margin-left: -1.25px;
    background: linear-gradient(to top, var(--gray-700), var(--gray-600));
    border-radius: 1.5px 1.5px 0 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.analog-clock[style*="width: 120px"] .second-hand {
    width: 1px;
    height: 42px;
    margin-left: -0.5px;
    background: linear-gradient(to top, var(--yellow-500), var(--yellow-400));
    border-radius: 1px;
    box-shadow: 0 1px 3px rgba(251, 191, 36, 0.5);
}

.hour-hand {
    width: 5px;
    height: 45px;
    background: linear-gradient(to top, var(--gray-900), var(--gray-800));
    margin-left: -2.5px;
    border-radius: 3px 3px 0 0;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
}

.minute-hand {
    width: 4px;
    height: 60px;
    background: linear-gradient(to top, var(--gray-700), var(--gray-600));
    margin-left: -2px;
    border-radius: 2px 2px 0 0;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
}

.second-hand {
    width: 2px;
    height: 70px;
    background: linear-gradient(to top, var(--yellow-500), var(--yellow-400));
    margin-left: -1px;
    border-radius: 1px;
    box-shadow: 0 2px 5px rgba(251, 191, 36, 0.6);
}

.clock-number {
    position: absolute;
    width: 100%;
    height: 100%;
    text-align: center;
    font-weight: 700;
    color: var(--gray-900);
    transform: rotate(calc(var(--i) * 30deg));
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Scale numbers based on clock size */
.analog-clock[style*="width: 120px"] .clock-number {
    font-size: 0.7rem;
}

.analog-clock[style*="width: 200px"] .clock-number {
    font-size: 1.125rem;
}

.clock-number::before {
    content: '';
    position: absolute;
    background: var(--gray-400);
    border-radius: 1px;
    top: 12%;
    left: 50%;
    transform: translateX(-50%);
}

.analog-clock[style*="width: 120px"] .clock-number::before {
    width: 1.5px;
    height: 6px;
}

.analog-clock[style*="width: 200px"] .clock-number::before {
    width: 2px;
    height: 10px;
}

/* Add hour markers */
.clock-face::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: 
        radial-gradient(circle 1px at 50% 8%, var(--gray-400), var(--gray-400) 1px, transparent 1px),
        radial-gradient(circle 1px at 92% 50%, var(--gray-400), var(--gray-400) 1px, transparent 1px),
        radial-gradient(circle 1px at 50% 92%, var(--gray-400), var(--gray-400) 1px, transparent 1px),
        radial-gradient(circle 1px at 8% 50%, var(--gray-400), var(--gray-400) 1px, transparent 1px);
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
}

.digital-time {
    color: white;
    text-align: center;
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    margin-top: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.digital-time > div:first-child {
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.digital-time > div:last-child {
    font-size: 0.8125rem;
    opacity: 0.9;
    font-weight: 500;
}

/* Company Name */
.company-name {
    text-align: center;
    margin-top: auto;
    position: relative;
    z-index: 1;
}

.company-name h1 {
    font-size: 2rem;
    font-weight: 800;
    color: white;
    margin: 0 0 0.5rem 0;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    letter-spacing: 0.5px;
    font-family: 'Poppins', sans-serif;
    line-height: 1.3;
}

.company-name .brand-subtitle {
    font-size: 0.9375rem;
    color: rgba(255, 255, 255, 0.95);
    margin: 0;
    font-weight: 500;
    letter-spacing: 0.25px;
    line-height: 1.5;
}

/* Right Side - Login Form */
.login-form-container {
    padding: 3.5rem 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--white);
}

.login-header {
    margin-bottom: 2rem;
}

.login-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
    font-family: 'Poppins', sans-serif;
    letter-spacing: -0.5px;
}

.login-subtitle {
    color: var(--gray-600);
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.5;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    position: relative;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    letter-spacing: 0.2px;
}

.form-input-group {
    position: relative;
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.75rem;
    font-size: 0.9375rem;
    border: 1.5px solid var(--gray-300);
    border-radius: 0.75rem;
    transition: var(--transition);
    background: var(--white);
    color: var(--gray-900);
    font-weight: 500;
}

.form-input::placeholder {
    color: var(--gray-400);
    font-weight: 400;
}

.form-input:hover {
    border-color: var(--gray-400);
}

.form-input:focus {
    outline: none;
    border-color: var(--blue-600);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

select.form-input {
    cursor: pointer;
    padding-right: 2.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    appearance: none;
}

.form-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 1.125rem;
    pointer-events: none;
    transition: var(--transition);
}

.form-input:focus + .form-icon,
.form-input-group:focus-within .form-icon {
    color: var(--blue-600);
}

.form-submit {
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--white);
    background: var(--blue-600);
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    letter-spacing: 0.3px;
    font-family: 'Inter', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.form-submit:hover {
    background: var(--blue-700);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.form-submit:active {
    transform: translateY(0);
}

.form-submit i {
    font-size: 1.125rem;
}

.form-footer {
    margin-top: 1.75rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 500;
}

.form-footer a {
    color: var(--blue-600);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.form-footer a:hover {
    color: var(--blue-700);
}

.form-footer a i {
    font-size: 0.75rem;
}

.form-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    color: var(--gray-500);
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-divider::before,
.form-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-200);
}

.form-divider span {
    padding: 0 1rem;
}

/* Admin Shield Logo */
.brand-logo {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
    color: var(--yellow-400);
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* Responsive Design */
@media (max-width: 968px) {
    .login-container {
        grid-template-columns: 1fr;
        max-width: 480px;
    }
    
    .login-brand {
        padding: 3rem 2rem;
    }
    
    .analog-clock {
        width: 160px;
        height: 160px;
    }
    
    .clock-face {
        border: 2px solid rgba(255, 255, 255, 0.3);
    }
    
    .clock-number {
        font-size: 1rem;
        line-height: 160px;
    }
    
    .hour-hand {
        height: 35px;
    }
    
    .minute-hand {
        height: 48px;
    }
    
    .second-hand {
        height: 56px;
    }
    
    .company-name h1 {
        font-size: 1.75rem;
    }
    
    .company-name .brand-subtitle {
        font-size: 0.875rem;
    }
    
    .login-form-container {
        padding: 3rem 2rem;
    }
    
    .login-title {
        font-size: 1.75rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 1rem;
    }
    
    .login-brand {
        padding: 2.5rem 1.5rem;
    }
    
    .brand-logo-modern {
        margin-bottom: 2rem;
    }
    
    .logo-icon {
        width: 56px;
        height: 56px;
        font-size: 1.75rem;
    }
    
    .logo-mebs {
        font-size: 1.5rem;
    }
    
    .logo-tagline {
        font-size: 0.6875rem;
    }
    
    .analog-clock {
        width: 140px;
        height: 140px;
    }
    
    .clock-number {
        font-size: 0.875rem;
        line-height: 140px;
    }
    
    .hour-hand {
        height: 30px;
        width: 5px;
        margin-left: -2.5px;
    }
    
    .minute-hand {
        height: 42px;
        width: 3px;
        margin-left: -1.5px;
    }
    
    .second-hand {
        height: 50px;
    }
    
    .digital-time > div:first-child {
        font-size: 1.125rem;
    }
    
    .digital-time > div:last-child {
        font-size: 0.75rem;
    }
    
    .company-name h1 {
        font-size: 1.5rem;
    }
    
    .company-name .brand-subtitle {
        font-size: 0.8125rem;
    }
    
    .login-form-container {
        padding: 2.5rem 1.5rem;
    }
    
    .login-title {
        font-size: 1.5rem;
    }
    
    .login-subtitle {
        font-size: 0.875rem;
    }
    
    .mebs-alert {
        left: 1rem;
        right: 1rem;
        top: 1rem;
        max-width: none;
    }
    
    .brand-logo {
        font-size: 3rem;
    }
}

/* Loading State */
.form-submit.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.form-submit.loading::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Enhanced Icon Styling - Login Page */
.fa-icon, .fas, .fab, .far {
    transition: all 0.2s ease;
}

.login-form i {
    font-size: 1.1em;
    margin-right: 0.4rem;
    color: var(--gray-500);
}

.form-input-group i {
    font-size: 1.15em;
    left: 1rem;
    color: var(--blue-500);
}

.button-icon {
    font-size: 1.1em;
    margin-right: 0.5rem;
}

.login-footer i {
    font-size: 1.05em;
    margin-right: 0.35rem;
}

/* Print optimization */
@media print {
    body::before,
    .login-brand::before {
        display: none;
    }
}
