/* ============================================ */
/* 🎨 OPTIMIZED LOGIN SCREEN */
/* Desktop & Mobile Responsive Design */
/* ============================================ */

/* Body background sa gradientom */
body.login-active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    overflow-x: hidden;
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile */
}

/* 🔧 KRITIČNO: Osiguraj da login screen nestane kada je hidden */
#login-screen.hidden {
    display: none !important;
}

.login-container.hidden {
    display: none !important;
}

/* Login container - savršeno centrirano */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile */
    padding: 20px;
    position: relative;
    overflow: hidden; /* Spriječi horizontalno skrolanje od dekorativnih krugova */
    box-sizing: border-box;
}

/* Decorative background circles */
.login-container::before {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    z-index: 0;
}

.login-container::after {
    content: '';
    position: absolute;
    bottom: -100px;
    left: -100px;
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    z-index: 0;
}

/* Login box - desktop optimized */
.login-box {
    background: white;
    border-radius: 20px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
    padding: 40px 32px;
    max-width: 380px;
    width: calc(100% - 40px);
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.6s ease;
    box-sizing: border-box;
    margin: auto;
}

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

/* Logo container */
.login-box .logo-container {
    text-align: center;
    margin-bottom: 32px;
}

.login-box .logo-container img {
    width: 200px;
    height: auto;
    margin-bottom: 20px;
    transition: transform 0.3s ease;
}

.login-box .logo-container img:hover {
    transform: scale(1.05);
}

.login-box .text-outline-firma {
    font-size: 16px;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
    color: #374151;
    font-weight: 700;
    text-transform: uppercase;
}

.login-box .company-subtitle {
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 12px;
}

/* Headings */
.login-box h2 {
    text-align: center;
    font-size: 36px;
    font-weight: 800;
    color: #1f2937;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-box > p {
    text-align: center;
    color: #6b7280;
    margin-bottom: 36px;
    font-size: 15px;
}

/* Form groups */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #f9fafb;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input::placeholder {
    color: #9ca3af;
}

/* Submit button */
.login-box .btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px;
    border-radius: 12px;
    border: none;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.login-box .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
}

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

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

/* Error message */
.login-box .error {
    background: #fee2e2;
    border: 2px solid #fecaca;
    color: #991b1b;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 20px;
    font-weight: 500;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* ============================================ */
/* TABLET RESPONSIVE (768px - 1024px) */
/* ============================================ */
@media (min-width: 768px) and (max-width: 1024px) {
    .login-box {
        max-width: 400px;
        padding: 44px 36px;
    }

    .login-box .logo-container img {
        width: 180px;
    }

    .login-box h2 {
        font-size: 32px;
    }
}

/* ============================================ */
/* DESKTOP LARGE (> 1024px) */
/* ============================================ */
@media (min-width: 1025px) {
    .login-container {
        padding: 40px;
    }

    .login-box {
        max-width: 420px;
        padding: 48px 40px;
    }

    .login-box .logo-container img {
        width: 200px;
    }

    .login-box h2 {
        font-size: 34px;
    }

    .login-box > p {
        font-size: 15px;
    }

    .form-group input {
        font-size: 16px;
        padding: 14px 18px;
    }

    .login-box .btn {
        padding: 16px;
        font-size: 16px;
    }
}

/* ============================================ */
/* MOBILE RESPONSIVE (< 768px) */
/* ============================================ */
@media (max-width: 767px) {
    .login-container {
        padding: 16px;
        min-height: 100vh;
        min-height: 100dvh;
        align-items: center;
    }

    .login-box {
        padding: 32px 24px;
        border-radius: 16px;
        max-width: 340px;
        width: calc(100% - 32px);
    }

    .login-box .logo-container img {
        width: 140px;
    }

    .login-box .text-outline-firma {
        font-size: 13px;
    }

    .login-box .company-subtitle {
        font-size: 11px;
    }

    .login-box h2 {
        font-size: 24px;
        margin-bottom: 8px;
    }

    .login-box > p {
        font-size: 13px;
        margin-bottom: 24px;
    }

    .form-group {
        margin-bottom: 18px;
    }

    .form-group label {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .form-group input {
        padding: 12px 14px;
        font-size: 16px; /* 16px sprječava zoom na iOS */
    }

    .login-box .btn {
        padding: 14px;
        font-size: 15px;
    }

    /* Hide decorative circles on mobile */
    .login-container::before,
    .login-container::after {
        display: none;
    }
}

/* Extra small devices (< 480px) */
@media (max-width: 480px) {
    .login-container {
        padding: 12px;
    }

    .login-box {
        padding: 28px 20px;
        width: calc(100% - 24px);
        max-width: 320px;
    }

    .login-box .logo-container {
        margin-bottom: 24px;
    }

    .login-box .logo-container img {
        width: 120px;
        margin-bottom: 14px;
    }

    .login-box h2 {
        font-size: 22px;
    }

    .login-box > p {
        font-size: 12px;
        margin-bottom: 20px;
    }

    .form-group {
        margin-bottom: 16px;
    }

    .login-box .btn {
        padding: 12px;
        font-size: 14px;
    }
}

/* ============================================ */
/* DARK MODE SUPPORT (optional) */
/* ============================================ */
body.dark-mode .login-box {
    background: #1f2937;
    color: #f9fafb;
}

body.dark-mode .login-box h2 {
    color: #f9fafb;
}

body.dark-mode .login-box .text-outline-firma,
body.dark-mode .login-box .company-subtitle {
    color: #d1d5db;
}

body.dark-mode .form-group label {
    color: #e5e7eb;
}

body.dark-mode .form-group input {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

body.dark-mode .form-group input::placeholder {
    color: #9ca3af;
}
