/**
 * Modern Login CSS - Mudashco ERP System
 * Scoped to .login-page to prevent conflicts with AdminLTE theme
 * Responsive design with RTL support
 */

/* ============================================
   BASE STYLES - Modern ERP Design
   ============================================ */

.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Decorative ERP-themed background pattern */
.login-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        /* Grid pattern */
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
}

/* Floating decorative shapes - ERP icons representation */
.login-page::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-image: 
        /* Chart bars */
        radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 85% 80%, rgba(255, 255, 255, 0.05) 0%, transparent 50%),
        /* Dashboard elements */
        radial-gradient(circle at 70% 30%, rgba(255, 255, 255, 0.03) 0%, transparent 40%),
        radial-gradient(circle at 30% 70%, rgba(255, 255, 255, 0.03) 0%, transparent 40%);
    pointer-events: none;
    animation: floatPattern 20s ease-in-out infinite;
}

@keyframes floatPattern {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-20px) scale(1.05);
    }
}

/* Language Selector Positioning - Only target the first row (language selector) */
.login-page > .row:first-of-type {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    width: auto;
    margin: 0;
}

.login-page > .row:first-of-type .col-md-12 {
    padding: 0;
}

.login-page > .row:first-of-type .form-group {
    margin: 0;
    padding: 0;
    width: auto;
}

.login-page .language_id {
    height: 36px !important;
    min-width: 150px !important;
    width: 150px !important;
    padding: 6px 30px 6px 12px !important;
    margin: 0 !important;
    border-radius: 8px !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    background: rgba(255, 255, 255, 0.95) !important;
    color: #333 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

.login-page .language_id:hover {
    background: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.login-page .language_id:focus {
    outline: none !important;
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2) !important;
}

/* Ensure login box rows are not affected */
.login-page .login-box .row {
    position: static !important;
    width: 100% !important;
    margin: 0 -15px !important;
}

/* Fix spacing for button row */
.login-page .login-box-body > form > .row {
    margin-bottom: 15px;
}

/* Fix spacing for links row */
.login-page .login-box-body > form > .row:last-of-type,
.login-page .login-box-body > .row {
    margin-top: 15px;
    margin-bottom: 0;
}

.login-page .login-box {
    width: 400px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
}

/* Decorative floating elements around login box */
.login-page .login-box::before,
.login-page .login-box::after {
    content: '';
    position: absolute;
    border-radius: 12px;
    opacity: 0.1;
    pointer-events: none;
}

/* Document/Invoice icon representation */
.login-page .login-box::before {
    width: 80px;
    height: 100px;
    background: white;
    top: -60px;
    right: -100px;
    box-shadow: 
        inset 0 10px 0 rgba(102, 126, 234, 0.3),
        inset 0 20px 0 rgba(102, 126, 234, 0.2),
        inset 0 30px 0 rgba(102, 126, 234, 0.1);
    animation: floatDocument 6s ease-in-out infinite;
}

/* Chart/Analytics icon representation */
.login-page .login-box::after {
    width: 100px;
    height: 80px;
    background: white;
    bottom: -60px;
    left: -100px;
    box-shadow: 
        inset 10px 0 0 rgba(118, 75, 162, 0.3),
        inset 30px 0 0 rgba(118, 75, 162, 0.2),
        inset 50px 0 0 rgba(118, 75, 162, 0.1);
    animation: floatChart 8s ease-in-out infinite;
}

@keyframes floatDocument {
    0%, 100% {
        transform: translateY(0) rotate(-5deg);
    }
    50% {
        transform: translateY(-15px) rotate(-8deg);
    }
}

@keyframes floatChart {
    0%, 100% {
        transform: translateY(0) rotate(5deg);
    }
    50% {
        transform: translateY(15px) rotate(8deg);
    }
}

.login-page .login-logo {
    text-align: center;
    margin-bottom: 0;
    position: relative;
    top: 50px;
    z-index: 10;
}

.login-page .login-logo a {
    display: inline-block;
    width: 100px;
    height: 100px;
    background: #ffffff;
    border-radius: 50%;
    padding: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
}

.login-page .login-logo a:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.login-page .login-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.login-page .login-box-body {
    background: #ffffff;
    padding: 70px 35px 35px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    transition: box-shadow 0.3s ease;
}

.login-page .login-box-body:hover {
    box-shadow: 0 15px 50px rgba(0,0,0,0.2);
}

.login-page .login-box-msg {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    margin-bottom: 25px;
    text-align: center;
}

/* ============================================
   FORM STYLES
   ============================================ */

.login-page .form-group {
    margin-bottom: 20px;
}

.login-page .form-control {
    height: 44px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    padding: 10px 15px 10px 40px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.login-page .form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

.login-page .form-control-feedback {
    line-height: 44px;
    color: #999;
    left: 15px;
    transition: color 0.3s ease;
}

.login-page .has-feedback .form-control:focus ~ .form-control-feedback {
    color: #667eea;
}

/* ============================================
   BUTTON STYLES
   ============================================ */

.login-page .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    height: 44px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    width: 100% !important;
    display: block !important;
}

.login-page .btn-primary:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

.login-page .btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

/* ============================================
   LINKS
   ============================================ */

.login-page a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.login-page a:hover {
    color: #764ba2;
    text-decoration: none;
}

/* ============================================
   FLASH MESSAGES
   ============================================ */

/* Hide flash messages by default */
.login-page .text-danger,
.login-page .text-success {
    display: none;
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

/* Show only when they have actual content (not just whitespace) */
.login-page .text-danger:not(:empty) {
    display: block;
    background: #fee;
    border-left: 4px solid #f44336;
}

.login-page .text-success:not(:empty) {
    display: block;
    background: #e8f5e9;
    border-left: 4px solid #4caf50;
}

/* ============================================
   VERSION INFO
   ============================================ */

.login-page .login-box-body p[style*="italic"] {
    color: #999;
    font-size: 13px;
    margin-top: 15px;
    margin-bottom: 0;
}

/* ============================================
   DEMO MODE STYLES
   ============================================ */

.login-page .box-body {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.login-page .box-body label {
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    display: block;
}

.login-page .box-body .table {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
}

.login-page .box-body .table td {
    padding: 12px;
    vertical-align: middle;
    border-color: #e0e0e0;
}

.login-page .box-body .btn-info {
    background: #667eea;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.login-page .box-body .btn-info:hover {
    background: #764ba2;
    transform: translateY(-1px);
}

.login-page .box-body i {
    color: #666;
    font-size: 13px;
}

.login-page .box-body .fa-info-circle {
    color: #ff9800;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Mobile devices (< 768px) */
@media (max-width: 767px) {
    .login-page > .row:first-of-type {
        top: 15px;
        right: 15px;
    }
    
    .login-page .language_id {
        height: 32px !important;
        min-width: 120px !important;
        width: 120px !important;
        font-size: 13px !important;
        padding: 5px 25px 5px 10px !important;
    }
    
    .login-page .login-box {
        width: 90%;
        max-width: 360px;
    }
    
    .login-page .login-logo {
        top: 40px;
    }
    
    .login-page .login-logo a {
        width: 80px;
        height: 80px;
        padding: 12px;
    }
    
    .login-page .login-box-body {
        padding: 60px 20px 25px;
    }
    
    .login-page .form-control {
        height: 48px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .login-page .btn-primary {
        height: 48px;
    }
    
    .login-page .box-body {
        padding: 15px;
    }
    
    .login-page .box-body .table td {
        padding: 8px;
        font-size: 13px;
    }
}

/* Tablet devices (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .login-page .login-box {
        width: 420px;
    }
    
    .login-page .login-logo {
        top: 45px;
    }
    
    .login-page .login-logo a {
        width: 90px;
        height: 90px;
        padding: 13px;
    }
    
    .login-page .login-box-body {
        padding: 65px 30px 30px;
    }
}

/* Desktop devices (> 1024px) */
@media (min-width: 1025px) {
    .login-page .login-box {
        width: 440px;
    }
    
    .login-page .login-box-body {
        padding: 70px 40px 40px;
    }
}

/* ============================================
   RTL SUPPORT (Arabic, Urdu)
   ============================================ */

[dir="rtl"] .login-page .form-control {
    padding: 10px 40px 10px 15px;
}

[dir="rtl"] .login-page .form-control-feedback {
    left: auto;
    right: 15px;
}

[dir="rtl"] .login-page .text-danger,
[dir="rtl"] .login-page .text-success {
    border-left: none;
    border-right: 4px solid;
}

[dir="rtl"] .login-page .text-danger {
    border-right-color: #f44336;
}

[dir="rtl"] .login-page .text-success {
    border-right-color: #4caf50;
}

[dir="rtl"] .login-page .pull-right {
    float: left !important;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-page .login-box {
    animation: fadeInUp 0.6s ease;
}

.login-page .login-box-body {
    animation: fadeInUp 0.8s ease;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.login-page .form-control:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.login-page .btn-primary:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .login-page .form-control {
        border-width: 2px;
    }
    
    .login-page .btn-primary {
        border: 2px solid #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .login-page * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
