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

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    /* Remove overflow hidden to allow scrolling on mobile */
    overflow-x: hidden;
    overflow-y: auto;
}

/* Color Tokens (White Theme) */
:root {
    --pertamina-red: #ED1C24;
    --pertamina-green: #00A651;
    --pertamina-blue: #2563EB;
    --primary-blue-dark: #1E40AF;
    --accent-blue: #2563EB;
    --accent-blue-dark: #1E40AF;
    --admin-primary: #2563EB;
    --admin-secondary: #1E40AF;
    --admin-accent: #3B82F6;
    --white-primary: #ffffff;
    --white-secondary: #f8fafc;
    --white-accent: #e2e8f0;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
}

body {
    font-family: 'Inter', sans-serif;
    /* Clean white background */
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 50%, #f1f5f9 100%);
    min-height: 100vh;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 0;
    padding: 1rem;
    /* Allow scrolling on mobile */
    overflow-x: hidden;
    overflow-y: auto;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-image: url('../image/bglog.jpg');
    background-size: cover;
    background-position: center bottom;
    background-repeat: no-repeat;
    filter: blur(3px) saturate(1.05) brightness(0.9);
    transform: scale(1.06);
    transform-origin: center;
    animation: pan 60s ease-in-out infinite alternate;
    z-index: -2;
}

/* White theme overlay for subtle depth */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 40%, rgba(255,255,255,0.02) 100%),
        radial-gradient(60% 60% at 50% 20%, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 60%, transparent 100%);
    pointer-events: none;
    z-index: -1;
}

@keyframes pan {
    0% { transform: scale(1.06) translate3d(0, 0, 0); }
    100% { transform: scale(1.08) translate3d(0, 5px, 0); }
}

/* Login Container */
.login-container {
    position: relative;
    z-index: 10;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 3rem;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.08);
    animation: slideUp 0.8s ease-out;
    margin: auto;
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(248, 250, 252, 0.1));
    border-radius: 24px;
    pointer-events: none;
    transition: all 0.3s ease;
}

.login-container:hover::before {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(248, 250, 252, 0.15));
}

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

/* Logo Section */
.logo-section {
    text-align: center;
    margin-bottom: 2.5rem;
}

.logo-icon {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    animation: breathingContainer 2.5s infinite;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.logo-icon img {
    width: 90%;
    height: 90%;
    object-fit: contain;
    animation: breathingImage 2.5s infinite;
}

@keyframes breathingContainer {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    }
}

@keyframes breathingImage {
    0%, 100% { 
        transform: scale(1);
        filter: blur(0px);
    }
    50% { 
        transform: scale(0.98);
        filter: blur(0px);
    }
}

.brand-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
    z-index: 1;
}

.brand-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 400;
    position: relative;
    z-index: 1;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

.input-wrapper {
    position: relative;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: all 0.3s ease;
    overflow: visible;
    z-index: 1;
}

.input-wrapper:focus-within {
    border-color: color-mix(in srgb, var(--accent-blue) 50%, transparent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-blue) 15%, transparent);
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.95);
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

.input-wrapper:focus-within .input-icon {
    color: var(--accent-blue);
}

.form-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    outline: none;
}

/* Special padding for password input to accommodate toggle button */
.form-input[type="password"],
.form-input[type="text"] {
    padding-right: 4rem;
}

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

.password-toggle {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    transition: color 0.3s ease;
    z-index: 20;
    pointer-events: auto;
    padding: 0.75rem;
    border-radius: 6px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.password-toggle:hover {
    color: #2563EB;
    background: rgba(37, 99, 235, 0.1);
}

.password-toggle:focus {
    color: #2563EB;
    background: rgba(37, 99, 235, 0.15);
    outline: 2px solid rgba(37, 99, 235, 0.5);
    outline-offset: 2px;
}

.password-toggle:active {
    transform: translateY(-50%) scale(0.95);
}

/* Enhanced Mobile optimization for password toggle */
@media (max-width: 768px) {
    .password-toggle {
        padding: 1.5rem;
        min-width: 60px;
        min-height: 60px;
        font-size: 1.4rem;
        right: 0.25rem;
        border-radius: 10px;
        /* Increase touch target size */
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(37, 99, 235, 0.2);
    }
    
    .password-toggle:active {
        transform: translateY(-50%) scale(0.9);
        background: rgba(37, 99, 235, 0.2);
    }
    
    /* Ensure password input has enough space for toggle button */
    .form-input[type="password"],
    .form-input[type="text"] {
        padding-right: 5.5rem;
    }
}

/* Tablet optimization for password toggle */
@media (min-width: 769px) and (max-width: 1024px) {
    .password-toggle {
        padding: 1.25rem;
        min-width: 55px;
        min-height: 55px;
        font-size: 1.3rem;
        right: 0.5rem;
        border-radius: 8px;
    }
    
    .form-input[type="password"],
    .form-input[type="text"] {
        padding-right: 5rem;
    }
}

/* Mobile landscape optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .password-toggle {
        padding: 1.25rem;
        min-width: 55px;
        min-height: 55px;
        font-size: 1.3rem;
        right: 0.5rem;
        border-radius: 8px;
    }
    
    .password-toggle:active {
        transform: translateY(-50%) scale(0.9);
        background: rgba(37, 99, 235, 0.2);
    }
    
    .form-input[type="password"],
    .form-input[type="text"] {
        padding-right: 5rem;
    }
}

/* Extra small mobile optimization */
@media (max-width: 480px) {
    .password-toggle {
        padding: 1.5rem;
        min-width: 65px;
        min-height: 65px;
        font-size: 1.5rem;
        right: 0.25rem;
        border-radius: 12px;
    }
    
    .form-input[type="password"],
    .form-input[type="text"] {
        padding-right: 6rem;
    }
}

/* Button Styles */
.login-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-blue-dark));
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    margin-top: 1rem;
}

.login-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.login-btn:hover::before {
    left: 100%;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px color-mix(in srgb, var(--accent-blue) 40%, transparent);
}

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

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

/* Loading Animation */
.loading {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error Message */
.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #dc2626;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: none;
    animation: shake 0.5s ease-in-out;
    font-weight: 500;
}

.error-message i {
    margin-right: 0.5rem;
}

/* Timeout Message */
.timeout-message {
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.3);
    color: #2563EB;
    animation: pulse 2s ease-in-out infinite;
}

/* Rate Limit Message */
.rate-limit-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #dc2626;
    animation: shake 0.5s ease-in-out;
    font-weight: 500;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Footer */
.footer-text {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-secondary);
    font-size: 0.7rem;
    position: relative;
    z-index: 1;
}

/* Enhanced Responsive Design */
@media (max-width: 768px) {
    body {
        height: auto;
        min-height: 100vh;
        padding: 0.5rem;
        /* Allow scrolling */
        overflow-x: hidden;
        overflow-y: auto;
    }
    
    .login-container {
        margin: 0.5rem;
        padding: 2rem;
        border-radius: 20px;
        max-width: 100%;
        min-height: auto;
    }

    .brand-title {
        font-size: 1.75rem;
    }

    .logo-icon {
        width: 80px;
        height: 80px;
    }
    
    /* Ensure form inputs are properly sized on mobile */
    .form-input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 1rem 1rem 1rem 3rem;
    }
}

@media (max-width: 480px) {
    body {
        height: auto;
        min-height: 100vh;
        padding: 0.25rem;
    }
    
    .login-container {
        padding: 1.5rem;
        margin: 0.25rem;
    }

    .brand-title {
        font-size: 1.5rem;
    }

    .form-input {
        padding: 0.875rem 0.875rem 0.875rem 2.5rem;
        font-size: 16px;
    }

    .input-icon {
        left: 0.875rem;
    }
    
    .logo-icon {
        width: 70px;
        height: 70px;
    }
}

/* Tablet specific optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    body {
        padding: 1rem;
    }
    
    .login-container {
        max-width: 500px;
        padding: 2.5rem;
    }
    
    .brand-title {
        font-size: 1.8rem;
    }
    
    .logo-icon {
        width: 90px;
        height: 90px;
    }
}

/* Landscape mode optimizations */
@media (max-width: 768px) and (orientation: landscape) {
    body {
        height: auto;
        min-height: 100vh;
        padding: 0.5rem;
    }
    
    .login-container {
        margin: 0.5rem auto;
        padding: 1.5rem;
        max-width: 90%;
    }
    
    .logo-section {
        margin-bottom: 1.5rem;
    }
    
    .logo-icon {
        width: 60px;
        height: 60px;
        margin-bottom: 0.5rem;
    }
    
    .brand-title {
        font-size: 1.4rem;
        margin-bottom: 0.25rem;
    }
    
    .brand-subtitle {
        font-size: 0.85rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .footer-text {
        margin-top: 1rem;
    }
}

/* Large screen optimizations */
@media (min-width: 1025px) {
    .login-container {
        max-width: 450px;
        padding: 3rem;
    }
    
    .brand-title {
        font-size: 2rem;
    }
    
    .logo-icon {
        width: 100px;
        height: 100px;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mb-0 {
    margin-bottom: 0;
}

.mt-2 {
    margin-top: 2rem;
}

/* Focus States for Accessibility */
.form-input:focus {
    outline: none;
}

.login-btn:focus {
    outline: 2px solid rgba(37, 99, 235, 0.5);
    outline-offset: 2px;
}

.password-toggle:focus {
    outline: 2px solid rgba(37, 99, 235, 0.5);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Notification System */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 350px;
}

.notification.show {
    transform: translateX(0);
}

.notification i {
    font-size: 1.2rem;
}

.notification-success {
    border-left: 4px solid #10b981;
    color: #065f46;
}

.notification-success i {
    color: #10b981;
}

.notification-error {
    border-left: 4px solid #ef4444;
    color: #991b1b;
}

.notification-error i {
    color: #ef4444;
}

.notification-info {
    border-left: 4px solid #2563EB;
    color: #1e40af;
}

.notification-info i {
    color: #2563EB;
}

/* Responsive notification */
@media (max-width: 768px) {
    .notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100%);
    }
    
    .notification.show {
        transform: translateY(0);
    }
}
