/* Mobile Login Page Styles */
@media (max-width: 768px) {
    .login-page {
        min-height: 100vh;
        padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        overflow-x: hidden;
    }

    .login-container {
        width: 100%;
        max-width: 100%;
        padding: 20px 15px;
        margin: 0;
    }

    .login-wrapper {
        flex-direction: column;
        gap: 30px;
        padding: 20px 0;
    }

    .login-header-container {
        text-align: center;
        margin-bottom: 20px;
    }

    .login-title {
        font-size: 2.2rem;
        margin-bottom: 10px;
        color: #ffffff;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }

    .login-subtitle {
        font-size: 1.1rem;
        color: #e8e8e8;
        margin: 0;
    }

    .login-content {
        flex-direction: column;
        gap: 30px;
    }

    .login-left {
        order: 2;
        width: 100%;
    }

    .login-right {
        order: 1;
        width: 100%;
        margin-bottom: 20px;
    }

    .login-form-container {
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        border-radius: 20px;
        padding: 30px 25px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }

    .login-form {
        width: 100%;
    }

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

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

    .input-wrapper {
        position: relative;
        display: flex;
        align-items: center;
        background: #f8f9fa;
        border: 2px solid #e9ecef;
        border-radius: 12px;
        transition: all 0.3s ease;
        overflow: hidden;
    }

    .input-wrapper:focus-within {
        border-color: #667eea;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
        background: #ffffff;
    }

    .input-wrapper input {
        flex: 1;
        padding: 15px 50px 15px 15px;
        border: none;
        background: transparent;
        font-size: 1rem;
        color: #333;
        outline: none;
    }

    .input-wrapper input::placeholder {
        color: #6c757d;
        opacity: 0.7;
    }

    .input-icon {
        position: absolute;
        left: 15px;
        font-size: 1.2rem;
        color: #6c757d;
        pointer-events: none;
    }

    .toggle-password {
        position: absolute;
        right: 15px;
        background: none;
        border: none;
        font-size: 1.2rem;
        color: #6c757d;
        cursor: pointer;
        padding: 5px;
        border-radius: 5px;
        transition: all 0.3s ease;
    }

    .toggle-password:hover {
        color: #667eea;
        background: rgba(102, 126, 234, 0.1);
    }

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

    /* Error Messages */
    .error-message {
        color: #dc3545;
        font-size: 0.85rem;
        margin-top: 5px;
        padding-left: 5px;
        min-height: 20px;
        display: flex;
        align-items: center;
    }

    .error-message:empty {
        display: none;
    }

    .input-wrapper.error {
        border-color: #dc3545;
        box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
    }

    .input-wrapper.error .input-icon {
        color: #dc3545;
    }

    .checkbox-group {
        display: flex;
        align-items: center;
        margin-bottom: 25px;
    }

    .checkbox-label {
        display: flex;
        align-items: center;
        cursor: pointer;
        font-size: 0.9rem;
        color: #555;
        line-height: 1.4;
    }

    .checkbox-label input[type="checkbox"] {
        display: none;
    }

    .checkmark {
        width: 20px;
        height: 20px;
        border: 2px solid #ddd;
        border-radius: 4px;
        margin-right: 10px;
        position: relative;
        transition: all 0.3s ease;
        background: #fff;
    }

    .checkbox-label input[type="checkbox"]:checked + .checkmark {
        background: #667eea;
        border-color: #667eea;
    }

    .checkbox-label input[type="checkbox"]:checked + .checkmark::after {
        content: '✓';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        color: white;
        font-size: 12px;
        font-weight: bold;
    }

    .login-btn {
        width: 100%;
        padding: 16px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        border: none;
        border-radius: 12px;
        font-size: 1.1rem;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        position: relative;
        overflow: hidden;
    }

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

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

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

    .btn-text {
        display: inline-block;
    }

    .btn-loading {
        display: none;
    }

    .login-btn.loading .btn-text {
        visibility: hidden;
    }

    .login-btn.loading .btn-loading {
        display: block;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

    .loading-dots {
        display: flex;
        gap: 4px;
        align-items: center;
        justify-content: center;
    }

    .loading-dots span {
        width: 8px;
        height: 8px;
        background: white;
        border-radius: 50%;
        animation: loadingDots 1.4s infinite ease-in-out;
    }

    .loading-dots span:nth-child(1) { animation-delay: -0.32s; }
    .loading-dots span:nth-child(2) { animation-delay: -0.16s; }

    @keyframes loadingDots {
        0%, 80%, 100% {
            transform: scale(0);
            opacity: 0.5;
        }
        40% {
            transform: scale(1);
            opacity: 1;
        }
    }

    .form-links {
        text-align: center;
        margin-top: 25px;
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .form-links a {
        color: #667eea;
        text-decoration: none;
        font-size: 0.95rem;
        transition: all 0.3s ease;
        padding: 8px 12px;
        border-radius: 8px;
        transition: all 0.3s ease;
    }

    .form-links a:hover {
        color: #5a6fd8;
        background: rgba(102, 126, 234, 0.1);
        text-decoration: underline;
    }

    .form-links a:active {
        transform: scale(0.98);
    }

    .register-link {
        font-weight: 600;
        color: #667eea !important;
    }

    .forgot-password-link {
        color: #6c757d !important;
        font-size: 0.9rem;
    }

    .welcome-message {
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        border-radius: 20px;
        padding: 25px;
        text-align: center;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }

    .welcome-header {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 15px;
        margin-bottom: 20px;
    }

    .mouse-tracking-cat-container {
        margin-bottom: 15px;
    }

    .mouse-tracking-cat {
        filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
    }

    .welcome-title {
        font-size: 1.8rem;
        font-weight: 700;
        color: #333;
        margin-bottom: 5px;
    }

    .welcome-subtitle {
        font-size: 1.1rem;
        color: #666;
        font-weight: 500;
    }

    .welcome-content {
        text-align: left;
    }

    .welcome-message-text p {
        margin: 12px 0;
        font-size: 1rem;
        color: #555;
        line-height: 1.5;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .welcome-message-text p::before {
        content: '';
        width: 6px;
        height: 6px;
        background: #667eea;
        border-radius: 50%;
        flex-shrink: 0;
    }

    .floating-elements-container {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        pointer-events: none;
        z-index: 1;
        overflow: hidden;
    }

    .floating-element {
        position: absolute;
        font-size: 1.5rem;
        opacity: 0.6;
        animation: float 6s ease-in-out infinite;
    }

    .star-1 {
        top: 15%;
        left: 10%;
        animation-delay: 0s;
    }

    .star-2 {
        top: 25%;
        right: 15%;
        animation-delay: 2s;
    }

    .sparkle-1 {
        bottom: 30%;
        left: 20%;
        animation-delay: 4s;
    }

    .sparkle-2 {
        bottom: 20%;
        right: 25%;
        animation-delay: 1s;
    }

    @keyframes float {
        0%, 100% {
            transform: translateY(0px) rotate(0deg);
            opacity: 0.6;
        }
        50% {
            transform: translateY(-20px) rotate(180deg);
            opacity: 1;
        }
    }
}

/* Extra Small Mobile Devices */
@media (max-width: 480px) {
    .login-container {
        padding: 15px 10px;
    }

    .login-wrapper {
        gap: 25px;
        padding: 15px 0;
    }

    .login-title {
        font-size: 2rem;
    }

    .login-subtitle {
        font-size: 1rem;
    }

    .login-form-container {
        padding: 25px 20px;
    }

    .input-wrapper input {
        padding: 14px 45px 14px 14px;
        font-size: 0.95rem;
    }

    .login-btn {
        padding: 15px;
        font-size: 1rem;
    }

    .welcome-message {
        padding: 20px;
    }

    .welcome-title {
        font-size: 1.6rem;
    }

    .welcome-subtitle {
        font-size: 1rem;
    }

    .welcome-message-text p {
        font-size: 0.95rem;
        margin: 10px 0;
    }
}

/* Landscape Mode */
@media (max-width: 768px) and (orientation: landscape) {
    .login-wrapper {
        flex-direction: row;
        gap: 20px;
        align-items: center;
    }

    .login-left {
        order: 1;
        width: 60%;
    }

    .login-right {
        order: 2;
        width: 40%;
        margin-bottom: 0;
    }

    .welcome-message {
        padding: 20px;
    }

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

    .welcome-subtitle {
        font-size: 1rem;
    }

    .welcome-message-text p {
        font-size: 0.9rem;
        margin: 8px 0;
    }
}

/* Touch Device Optimizations */
@media (max-width: 768px) and (hover: none) {
    .login-btn:hover {
        transform: none;
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    }

    .form-links a:hover {
        background: transparent;
    }

    .toggle-password:hover {
        background: transparent;
        color: #6c757d;
    }

    .input-wrapper:hover {
        border-color: #e9ecef;
    }
}

/* High DPI Displays */
@media (max-width: 768px) and (-webkit-min-device-pixel-ratio: 2),
       (max-width: 768px) and (min-resolution: 192dpi) {
    .input-wrapper input {
        font-size: 16px; /* Prevents zoom on iOS */
    }

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

    .form-links a {
        font-size: 16px;
    }
}

/* Safe Area Support */
@supports (padding: max(0px)) {
    @media (max-width: 768px) {
        .login-page {
            padding-left: max(15px, env(safe-area-inset-left));
            padding-right: max(15px, env(safe-area-inset-right));
        }

        .login-container {
            padding-left: max(15px, env(safe-area-inset-left));
            padding-right: max(15px, env(safe-area-inset-right));
        }
    }
}

/* Focus Styles for Accessibility */
@media (max-width: 768px) {
    .input-wrapper:focus-within {
        outline: 2px solid #667eea;
        outline-offset: 2px;
    }

    .login-btn:focus {
        outline: 2px solid #667eea;
        outline-offset: 2px;
    }

    .form-links a:focus {
        outline: 2px solid #667eea;
        outline-offset: 2px;
        border-radius: 8px;
    }

    .toggle-password:focus {
        outline: 2px solid #667eea;
        outline-offset: 2px;
    }
}

/* Form Validation States */
@media (max-width: 768px) {
    .input-wrapper.valid {
        border-color: #28a745;
        box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
    }

    .input-wrapper.valid .input-icon {
        color: #28a745;
    }

    .input-wrapper.invalid {
        border-color: #dc3545;
        box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
    }

    .input-wrapper.invalid .input-icon {
        color: #dc3545;
    }
}

/* Loading States */
@media (max-width: 768px) {
    .login-btn.loading {
        pointer-events: none;
    }

    .login-btn.loading::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 20px;
        height: 20px;
        border: 2px solid transparent;
        border-top: 2px solid white;
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }

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

/* Print Styles */
@media (max-width: 768px) and print {
    .login-page {
        background: white !important;
        color: black !important;
    }

    .login-form-container,
    .welcome-message {
        background: white !important;
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }

    .floating-elements-container {
        display: none !important;
    }
}
